mirror of
https://github.com/onionshare/onionshare.git
synced 2025-02-04 17:05:31 -05:00
Check for public_mode in the check_slug_candidate function, to make 404 errors work again during public mode
This commit is contained in:
parent
8bb75cc530
commit
9815c612eb
@ -143,7 +143,6 @@ class Web(object):
|
||||
"""
|
||||
@self.app.route("/<slug_candidate>")
|
||||
def index(slug_candidate):
|
||||
if not self.common.settings.get('public_mode'):
|
||||
self.check_slug_candidate(slug_candidate)
|
||||
return index_logic()
|
||||
|
||||
@ -187,7 +186,6 @@ class Web(object):
|
||||
|
||||
@self.app.route("/<slug_candidate>/download")
|
||||
def download(slug_candidate):
|
||||
if not self.common.settings.get('public_mode'):
|
||||
self.check_slug_candidate(slug_candidate)
|
||||
return download_logic()
|
||||
|
||||
@ -331,7 +329,6 @@ class Web(object):
|
||||
|
||||
@self.app.route("/<slug_candidate>")
|
||||
def index(slug_candidate):
|
||||
if not self.common.settings.get('public_mode'):
|
||||
self.check_slug_candidate(slug_candidate)
|
||||
return index_logic()
|
||||
|
||||
@ -430,7 +427,6 @@ class Web(object):
|
||||
|
||||
@self.app.route("/<slug_candidate>/upload", methods=['POST'])
|
||||
def upload(slug_candidate):
|
||||
if not self.common.settings.get('public_mode'):
|
||||
self.check_slug_candidate(slug_candidate)
|
||||
return upload_logic(slug_candidate)
|
||||
|
||||
@ -452,7 +448,6 @@ class Web(object):
|
||||
|
||||
@self.app.route("/<slug_candidate>/close", methods=['POST'])
|
||||
def close(slug_candidate):
|
||||
if not self.common.settings.get('public_mode'):
|
||||
self.check_slug_candidate(slug_candidate)
|
||||
return close_logic(slug_candidate)
|
||||
|
||||
@ -574,6 +569,10 @@ class Web(object):
|
||||
self.app.logger.addHandler(log_handler)
|
||||
|
||||
def check_slug_candidate(self, slug_candidate, slug_compare=None):
|
||||
self.common.log('Web', 'check_slug_candidate: slug_candidate={}, slug_compare={}'.format(slug_candidate, slug_compare))
|
||||
if self.common.settings.get('public_mode'):
|
||||
abort(404)
|
||||
else:
|
||||
if not slug_compare:
|
||||
slug_compare = self.slug
|
||||
if not hmac.compare_digest(slug_compare, slug_candidate):
|
||||
|
Loading…
x
Reference in New Issue
Block a user