Fix content type indentification
This commit is contained in:
parent
9fee86df59
commit
e46cb2f240
1 changed files with 11 additions and 2 deletions
|
@ -290,8 +290,17 @@ class UiRequest(object):
|
||||||
if match:
|
if match:
|
||||||
address = match.group("address")
|
address = match.group("address")
|
||||||
inner_path = match.group("inner_path").lstrip("/")
|
inner_path = match.group("inner_path").lstrip("/")
|
||||||
if "." in inner_path and not inner_path.endswith(".html") and not inner_path.endswith(".htm"):
|
|
||||||
return self.actionSiteMedia("/media" + path) # Only serve html files with frame
|
if not inner_path or path.endswith("/"): # It's a directory
|
||||||
|
content_type = self.getContentType("index.html")
|
||||||
|
else: # It's a file
|
||||||
|
content_type = self.getContentType(inner_path)
|
||||||
|
|
||||||
|
is_html_file = "html" in content_type or "xhtml" in content_type
|
||||||
|
|
||||||
|
if not is_html_file:
|
||||||
|
return self.actionSiteMedia("/media" + path) # Serve non-html files without wrapper
|
||||||
|
|
||||||
if self.isAjaxRequest():
|
if self.isAjaxRequest():
|
||||||
return self.error403("Ajax request not allowed to load wrapper") # No ajax allowed on wrapper
|
return self.error403("Ajax request not allowed to load wrapper") # No ajax allowed on wrapper
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue