# HG changeset patch # User Ludovic Chabant # Date 1422690714 28800 # Node ID 0b2d8f6df4ceac6ec3310d6c099cbda0a0c6a0dc # Parent 681da9009290e629f6e9a199cf54d7b6e5da204b internal: A bit of input validation for source APIs. diff -r 681da9009290 -r 0b2d8f6df4ce piecrust/sources/base.py --- 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: