From f506ac970190cbb6e6b53d294d618d44e55e2fed Mon Sep 17 00:00:00 2001 From: shortcutme Date: Thu, 15 Jun 2017 13:30:36 +0200 Subject: [PATCH] Faster getPath --- src/Site/SiteStorage.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Site/SiteStorage.py b/src/Site/SiteStorage.py index 103f184e..1101d56a 100644 --- a/src/Site/SiteStorage.py +++ b/src/Site/SiteStorage.py @@ -317,7 +317,10 @@ class SiteStorage(object): if path == self.directory: inner_path = "" else: - inner_path = re.sub("^%s/" % re.escape(self.directory), "", path) + if path.startswith(self.directory): + inner_path = path[len(self.directory)+1:] + else: + raise Exception(u"File not allowed: %s" % path) return inner_path # Verify all files sha512sum using content.json