diff options
author | Miguel Jacq <mig@mig5.net> | 2019-09-09 17:22:18 +1000 |
---|---|---|
committer | Miguel Jacq <mig@mig5.net> | 2019-09-09 17:23:09 +1000 |
commit | 86a2b35d9ddc6c0fb9d068ca0f45c48fbfcaa219 (patch) | |
tree | f132f18c0b8c1569e83b83f1dfb7a0dab2e99629 | |
parent | b1aa36e805736adcd1ebe7cec7a0ed210631a37b (diff) | |
download | onionshare-86a2b35d9ddc6c0fb9d068ca0f45c48fbfcaa219.tar.gz onionshare-86a2b35d9ddc6c0fb9d068ca0f45c48fbfcaa219.zip |
Ensure we increment and return the history_id when throwing error404() in website mode. Add a route for /favicon.ico unless we are in website mode (website might have its own favicon)
-rw-r--r-- | onionshare/web/web.py | 7 | ||||
-rw-r--r-- | onionshare/web/website_mode.py | 8 |
2 files changed, 12 insertions, 3 deletions
diff --git a/onionshare/web/web.py b/onionshare/web/web.py index 2b0d2812..ca63e520 100644 --- a/onionshare/web/web.py +++ b/onionshare/web/web.py @@ -10,7 +10,7 @@ from distutils.version import LooseVersion as Version from urllib.request import urlopen import flask -from flask import Flask, request, render_template, abort, make_response, __version__ as flask_version +from flask import Flask, request, render_template, abort, make_response, send_file, __version__ as flask_version from flask_httpauth import HTTPBasicAuth from .. import strings @@ -178,6 +178,11 @@ class Web: return "" abort(404) + if self.mode != 'website': + @self.app.route("/favicon.ico") + def favicon(): + return send_file('{}/img/favicon.ico'.format(self.common.get_resource_path('static'))) + def error401(self): auth = request.authorization if auth: diff --git a/onionshare/web/website_mode.py b/onionshare/web/website_mode.py index 55e5c1d4..0b7602ea 100644 --- a/onionshare/web/website_mode.py +++ b/onionshare/web/website_mode.py @@ -70,7 +70,9 @@ class WebsiteModeWeb(SendBaseModeWeb): # If it's not a directory or file, throw a 404 else: - return self.web.error404() + history_id = self.cur_history_id + self.cur_history_id += 1 + return self.web.error404(history_id) else: # Special case loading / @@ -87,4 +89,6 @@ class WebsiteModeWeb(SendBaseModeWeb): else: # If the path isn't found, throw a 404 - return self.web.error404() + history_id = self.cur_history_id + self.cur_history_id += 1 + return self.web.error404(history_id) |