Faster getPath

This commit is contained in:
shortcutme 2017-06-15 13:30:36 +02:00
parent 97b3563e6b
commit f506ac9701
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -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