Skip to content

Commit

Permalink
Fix incorrect behaviour with two character directory names.
Browse files Browse the repository at this point in the history
Independetely found and fixed by both Thomas Waldemann and
Cam Hutchison. Closes jborg#265 and jborg#268.
  • Loading branch information
jborg committed Apr 13, 2015
1 parent 7198929 commit 20026e5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion attic/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 2 additions & 1 deletion attic/testsuite/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 20026e5

Please sign in to comment.