Update share_mode.py

This commit is contained in:
whew 2021-05-13 08:15:17 +00:00 committed by GitHub
parent a2ba9e5f1d
commit 4e335800a5

View file

@ -149,8 +149,7 @@ class ShareModeWeb(SendBaseModeWeb):
and self.download_in_progress and self.download_in_progress
) )
if deny_download: if deny_download:
r = make_response(render_template("denied.html")) return render_template("denied.html")
return self.web.add_security_headers(r)
# If download is allowed to continue, serve download page # If download is allowed to continue, serve download page
if self.should_use_gzip(): if self.should_use_gzip():
@ -172,8 +171,7 @@ class ShareModeWeb(SendBaseModeWeb):
and self.download_in_progress and self.download_in_progress
) )
if deny_download: if deny_download:
r = make_response(render_template("denied.html")) return render_template("denied.html")
return self.web.add_security_headers(r)
# Prepare some variables to use inside generate() function below # Prepare some variables to use inside generate() function below
# which is outside of the request context # which is outside of the request context
@ -232,7 +230,6 @@ class ShareModeWeb(SendBaseModeWeb):
"filename*": "UTF-8''%s" % url_quote(basename), "filename*": "UTF-8''%s" % url_quote(basename),
} }
r.headers.set("Content-Disposition", "attachment", **filename_dict) r.headers.set("Content-Disposition", "attachment", **filename_dict)
r = self.web.add_security_headers(r)
# guess content type # guess content type
(content_type, _) = mimetypes.guess_type(basename, strict=False) (content_type, _) = mimetypes.guess_type(basename, strict=False)
if content_type is not None: if content_type is not None: