diff options
author | Michał Górny <mgorny@gentoo.org> | 2017-11-22 13:18:50 +0100 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2017-11-22 13:18:50 +0100 |
commit | eeea0473e34096543303402a14cfd23514975d22 (patch) | |
tree | ca0c5fa9aa2be141ba9a79fb26769f061fd8b1ec | |
parent | c18e5944baa28b6fd66fa6102f66056163fc1a91 (diff) | |
download | gemato-eeea0473e34096543303402a14cfd23514975d22.tar.gz |
manifest: Forbid backslash in paths too
-rw-r--r-- | gemato/manifest.py | 2 | ||||
-rw-r--r-- | tests/test_manifest.py | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/gemato/manifest.py b/gemato/manifest.py index b54674f..2739af4 100644 --- a/gemato/manifest.py +++ b/gemato/manifest.py @@ -55,7 +55,7 @@ class ManifestPathEntry(object): """ __slots__ = ['path'] - disallowed_path_re = re.compile(r'[\0\s]', re.U) + disallowed_path_re = re.compile(r'[\0\s\\]', re.U) def __init__(self, path): assert path[0] != '/' diff --git a/tests/test_manifest.py b/tests/test_manifest.py index 9995996..d9d8c08 100644 --- a/tests/test_manifest.py +++ b/tests/test_manifest.py @@ -443,3 +443,8 @@ class NewManifestEntryTest(unittest.TestCase): self.assertRaises(gemato.exceptions.ManifestInvalidFilename, gemato.manifest.new_manifest_entry, 'DATA', u'tes\0t', 32, {}), + + def test_backslash_in_filename(self): + self.assertRaises(gemato.exceptions.ManifestInvalidFilename, + gemato.manifest.new_manifest_entry, 'DATA', + u'tes\\t', 32, {}), |