diff options
-rw-r--r-- | manifest_xml.py | 12 | ||||
-rw-r--r-- | tests/test_manifest_xml.py | 2 |
2 files changed, 9 insertions, 5 deletions
diff --git a/manifest_xml.py b/manifest_xml.py index 035cc61b..b92b2675 100644 --- a/manifest_xml.py +++ b/manifest_xml.py | |||
@@ -985,11 +985,13 @@ class XmlManifest(object): | |||
985 | # Assume paths might be used on case-insensitive filesystems. | 985 | # Assume paths might be used on case-insensitive filesystems. |
986 | path = path.lower() | 986 | path = path.lower() |
987 | 987 | ||
988 | # We don't really need to reject '.' here, but there shouldn't really be a | 988 | # Some people use src="." to create stable links to projects. Lets allow |
989 | # need to ever use it, so no need to accept it either. | 989 | # that but reject all other uses of "." to keep things simple. |
990 | for part in set(path.split(os.path.sep)): | 990 | parts = path.split(os.path.sep) |
991 | if part in {'.', '..', '.git'} or part.startswith('.repo'): | 991 | if parts != ['.']: |
992 | return 'bad component: %s' % (part,) | 992 | for part in set(parts): |
993 | if part in {'.', '..', '.git'} or part.startswith('.repo'): | ||
994 | return 'bad component: %s' % (part,) | ||
993 | 995 | ||
994 | if not symlink and path.endswith(os.path.sep): | 996 | if not symlink and path.endswith(os.path.sep): |
995 | return 'dirs not allowed' | 997 | return 'dirs not allowed' |
diff --git a/tests/test_manifest_xml.py b/tests/test_manifest_xml.py index ecc84ad7..b6ec5b86 100644 --- a/tests/test_manifest_xml.py +++ b/tests/test_manifest_xml.py | |||
@@ -49,6 +49,8 @@ class ManifestValidateFilePaths(unittest.TestCase): | |||
49 | # We allow symlinks to end in a slash since we allow them to point to dirs | 49 | # We allow symlinks to end in a slash since we allow them to point to dirs |
50 | # in general. Technically the slash isn't necessary. | 50 | # in general. Technically the slash isn't necessary. |
51 | check('foo/', 'bar') | 51 | check('foo/', 'bar') |
52 | # We allow a single '.' to get a reference to the project itself. | ||
53 | check('.', 'bar') | ||
52 | 54 | ||
53 | def test_bad_paths(self): | 55 | def test_bad_paths(self): |
54 | """Make sure bad paths (src & dest) are rejected.""" | 56 | """Make sure bad paths (src & dest) are rejected.""" |