Fix some corner-cases for requests at root path

This commit is contained in:
Guillaume Ayoub 2013-05-01 20:13:51 +02:00
parent f73b44a311
commit e4af425893

View File

@ -210,8 +210,8 @@ class Collection(object):
# First do normpath and then strip, to prevent access to FOLDER/../ # First do normpath and then strip, to prevent access to FOLDER/../
sane_path = posixpath.normpath(path.replace(os.sep, "/")).strip("/") sane_path = posixpath.normpath(path.replace(os.sep, "/")).strip("/")
attributes = sane_path.split("/") attributes = sane_path.split("/")
if not attributes: if not sane_path or not attributes:
return None return []
if not (cls.is_leaf("/".join(attributes)) or path.endswith("/")): if not (cls.is_leaf("/".join(attributes)) or path.endswith("/")):
attributes.pop() attributes.pop()