1
0
Fork 0
forked from github/pelican
This commit is contained in:
Irfan Ahmad 2012-12-10 03:03:48 +05:00 committed by Alexis Métaireau
commit 385a18563c
2 changed files with 7 additions and 2 deletions

View file

@ -74,7 +74,11 @@ class TestUtils(LoggedTestCase):
samples = ((os.path.join('test', 'test.html'), os.pardir),
(os.path.join('test', 'test', 'test.html'),
os.path.join(os.pardir, os.pardir)),
('test.html', os.curdir))
('test.html', os.curdir),
(os.path.join('/test', 'test.html'), os.pardir),
(os.path.join('/test', 'test', 'test.html'),
os.path.join(os.pardir, os.pardir)),
('/test.html', os.curdir),)
for value, expected in samples:
self.assertEquals(utils.get_relative_path(value), expected)

View file

@ -501,8 +501,9 @@ def split_all(path):
['a', 'b', 'c']
"""
components = []
path = path.lstrip('/')
while path:
head,tail = os.path.split(path)
head, tail = os.path.split(path)
if tail:
components.insert(0, tail)
elif head == path: