Fix allowed characters in package and restore a comment
Follow-up to commit
MOS_MIGRATED_REVID=148450575
@@ -39,7 +39,11 @@ public final class LabelValidator {
* Matches characters allowed in package name (allowed are A-Z, a-z, 0-9, '/', '-', '.' and '_')
*/
private static final CharMatcher ALLOWED_CHARACTERS_IN_PACKAGE_NAME =
- CharMatcher.javaLetterOrDigit().or(CharMatcher.anyOf("/-._")).precomputed();
+ CharMatcher.inRange('0', '9')
+ .or(CharMatcher.inRange('a', 'z'))
+ .or(CharMatcher.inRange('A', 'Z'))
+ .or(CharMatcher.anyOf("/-._"))
+ .precomputed();
/**
* Matches characters allowed in target names regardless of context.
@@ -121,6 +125,10 @@ public final class LabelValidator {
*/
@Nullable
public static String validateTargetName(String targetName) {
+ // We allow labels equaling '.' or ending in '/.' for now. If we ever
+ // actually configure the target we will report an error, but they are permitted for
+ // data directories.
+
// Code optimized for the common case: success.
int len = targetName.length();
if (len == 0) {
