Fix exception if no path_parts returned
This commit is contained in:
parent
b88ee9a87a
commit
504d7812e5
1 changed files with 37 additions and 38 deletions
|
@ -423,6 +423,9 @@ class UiRequest(object):
|
|||
|
||||
path_parts = self.parsePath(path)
|
||||
|
||||
if not path_parts:
|
||||
return self.error404(path)
|
||||
|
||||
# Check wrapper nonce
|
||||
content_type = self.getContentType(path_parts["inner_path"])
|
||||
if "htm" in content_type and not header_noscript: # Valid nonce must present to render html files
|
||||
|
@ -437,7 +440,6 @@ class UiRequest(object):
|
|||
self.log.error("Media referrer error: %s not allowed from %s" % (self.getRequestUrl(), self.getReferer()))
|
||||
return self.error403("Media referrer error") # Referrer not starts same address as requested path
|
||||
|
||||
if path_parts: # Looks like a valid path
|
||||
address = path_parts["address"]
|
||||
file_path = "%s/%s/%s" % (config.data_dir, address, path_parts["inner_path"])
|
||||
if config.debug and file_path.split("/")[-1].startswith("all."):
|
||||
|
@ -474,9 +476,6 @@ class UiRequest(object):
|
|||
self.server.wrapper_nonces.append(self.get.get("wrapper_nonce"))
|
||||
return self.error404(path_parts["inner_path"])
|
||||
|
||||
else: # Bad url
|
||||
return self.error404(path)
|
||||
|
||||
# Serve a media for ui
|
||||
def actionUiMedia(self, path):
|
||||
match = re.match("/uimedia/(?P<inner_path>.*)", path)
|
||||
|
|
Loading…
Reference in a new issue