1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-22 15:57:15 +00:00

Fix incorrect behaviour with two character directory names.

Independetely found and fixed by both Thomas Waldemann and
Cam Hutchison. Closes #265 and #268.
This commit is contained in:
Jonas Borgström 2015-04-13 22:44:14 +02:00
parent 7198929bae
commit 20026e58aa
3 changed files with 4 additions and 2 deletions

View file

@ -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.

View file

@ -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):

View file

@ -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):