Improve specific tag redirect.

Previous version had a bug when the URL contained percent-encoded
spaces because url.replace() was looking for spaces and not replacing
the %20. Constructing the url from parts is more reliable.
This commit is contained in:
voussoir 2021-01-05 01:25:29 -08:00
parent 29774f2524
commit bef91b959b

View file

@ -80,7 +80,7 @@ def get_tags_html(specific_tag_name=None):
else:
specific_tag = common.P_tag(specific_tag_name, response_type='html')
if specific_tag.name != specific_tag_name:
new_url = request.url.replace('/tag/' + specific_tag_name, '/tag/' + specific_tag.name)
new_url = '/tag/' + specific_tag.name + request.query_string.decode('utf-8')
return flask.redirect(new_url)
include_synonyms = request.args.get('include_synonyms')