diff --git a/CHANGES b/CHANGES index 4a92bff90..1b7b3788b 100644 --- a/CHANGES +++ b/CHANGES @@ -7,6 +7,7 @@ Version 0.15 ------------ (feature release, released on X) +- Fix incorrect behavior with two character directory names (#265, #268) - Require approval before accessing relocated/moved repository (#271) - Require approval before accessing previously unknown unencrypted repositories (#271) - Fix issue with hash index files larger than 2GB. diff --git a/attic/helpers.py b/attic/helpers.py index 6f1be7650..646ba2571 100644 --- a/attic/helpers.py +++ b/attic/helpers.py @@ -513,7 +513,7 @@ def remove_surrogates(s, errors='replace'): return s.encode('utf-8', errors).decode('utf-8') -_safe_re = re.compile('^((..)?/+)+') +_safe_re = re.compile(r'^((\.\.)?/+)+') def make_path_safe(path): diff --git a/attic/testsuite/helpers.py b/attic/testsuite/helpers.py index e84e4dc29..e8c9ee402 100644 --- a/attic/testsuite/helpers.py +++ b/attic/testsuite/helpers.py @@ -109,12 +109,13 @@ class MakePathSafeTestCase(AtticTestCase): def test(self): self.assert_equal(make_path_safe('/foo/bar'), 'foo/bar') self.assert_equal(make_path_safe('/foo/bar'), 'foo/bar') + self.assert_equal(make_path_safe('/f/bar'), 'f/bar') + self.assert_equal(make_path_safe('fo/bar'), 'fo/bar') self.assert_equal(make_path_safe('../foo/bar'), 'foo/bar') self.assert_equal(make_path_safe('../../foo/bar'), 'foo/bar') self.assert_equal(make_path_safe('/'), '.') self.assert_equal(make_path_safe('/'), '.') - class UpgradableLockTestCase(AtticTestCase): def test(self):