From bef91b959b8082438edc627ae093f1b2c0906d71 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Tue, 5 Jan 2021 01:25:29 -0800 Subject: [PATCH] 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. --- frontends/etiquette_flask/backend/endpoints/tag_endpoints.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontends/etiquette_flask/backend/endpoints/tag_endpoints.py b/frontends/etiquette_flask/backend/endpoints/tag_endpoints.py index 8ca6701..274b69e 100644 --- a/frontends/etiquette_flask/backend/endpoints/tag_endpoints.py +++ b/frontends/etiquette_flask/backend/endpoints/tag_endpoints.py @@ -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')