Rev3354, Fix ajax loading files from archives

This commit is contained in:
shortcutme 2018-03-09 15:01:45 +01:00
parent 645249afa9
commit 738fd1a09b
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE
3 changed files with 15 additions and 6 deletions

View file

@ -58,10 +58,18 @@ class UiRequestPlugin(object):
site.updateWebsocket(file_done=site.storage.getInnerPath(file_path))
if not result:
return self.error404(path)
if self.get.get("ajax_key"):
requester_site = self.server.site_manager.get(path_parts["request_address"])
if self.get["ajax_key"] == requester_site.settings["ajax_key"]:
header_allow_ajax = True
else:
return self.error403("Invalid ajax_key")
try:
file = openArchiveFile(archive_path, path_within)
content_type = self.getContentType(file_path)
self.sendHeader(200, content_type=content_type, noscript=kwargs.get("header_noscript", False))
self.sendHeader(200, content_type=content_type, noscript=kwargs.get("header_noscript", False), allow_ajax=header_allow_ajax)
return self.streamFile(file)
except Exception as err:
self.log.debug("Error opening archive file: %s" % err)