kopia lustrzana https://github.com/snarfed/bridgy-fed
/r/: drop "User not found for domain" message on 404
security through obscurity (heh), no need to signal that spammers can make a user somehow to get their redirects working.flask
rodzic
f9e8a5abd2
commit
2bae0c999c
|
@ -31,7 +31,6 @@ class RedirectHandler(common.Handler):
|
||||||
|
|
||||||
e.g. redirects /r/https://foo.com/bar?baz to https://foo.com/bar?baz
|
e.g. redirects /r/https://foo.com/bar?baz to https://foo.com/bar?baz
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@cache_response(CACHE_TIME)
|
@cache_response(CACHE_TIME)
|
||||||
def get(self):
|
def get(self):
|
||||||
assert self.request.path_qs.startswith('/r/')
|
assert self.request.path_qs.startswith('/r/')
|
||||||
|
@ -47,7 +46,8 @@ class RedirectHandler(common.Handler):
|
||||||
logging.info(f'Found MagicKey for domain {domain}')
|
logging.info(f'Found MagicKey for domain {domain}')
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
self.error(f'No user found for any of {domains}', status=404)
|
logging.info(f'No user found for any of {domains}; returning 404')
|
||||||
|
self.abort(404)
|
||||||
|
|
||||||
# poor man's conneg, only handle single Accept values, not multiple with
|
# poor man's conneg, only handle single Accept values, not multiple with
|
||||||
# priorities.
|
# priorities.
|
||||||
|
|
Ładowanie…
Reference in New Issue