Mercurial > piecrust2
diff piecrust/sources/base.py @ 211:0b2d8f6df4ce
internal: A bit of input validation for source APIs.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Fri, 30 Jan 2015 23:51:54 -0800 |
parents | e61fbae61402 |
children | e9dc18a275ff |
line wrap: on
line diff
--- a/piecrust/sources/base.py Thu Jan 22 22:26:58 2015 -0800 +++ b/piecrust/sources/base.py Fri Jan 30 23:51:54 2015 -0800 @@ -340,7 +340,7 @@ def resolveRef(self, ref_path): return os.path.normpath( - os.path.join(self.fs_endpoint_path, ref_path)) + os.path.join(self.fs_endpoint_path, ref_path.lstrip("\\/"))) def findPagePath(self, metadata, mode): uri_path = metadata.setdefault('path', '') @@ -373,7 +373,7 @@ return None, None def listPath(self, rel_path): - path = os.path.join(self.fs_endpoint_path, rel_path) + path = os.path.join(self.fs_endpoint_path, rel_path.lstrip("\\/")) names = sorted(os.listdir(path)) items = [] for name in names: