From fa176fdfb822b68fe82f97a7cc84025ba69074cb Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Wed, 14 Jun 2017 12:31:17 -0700 Subject: [PATCH] Redirect /tags/abcde to /tag/abcde --- .../etiquette_flask/etiquette_flask/etiquette_flask.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/frontends/etiquette_flask/etiquette_flask/etiquette_flask.py b/frontends/etiquette_flask/etiquette_flask/etiquette_flask.py index e293de5..da888cc 100644 --- a/frontends/etiquette_flask/etiquette_flask/etiquette_flask.py +++ b/frontends/etiquette_flask/etiquette_flask/etiquette_flask.py @@ -734,8 +734,8 @@ def get_search_json(): return jsonify.make_json_response(search_results) +@site.route('/tag/') @site.route('/tags') -@site.route('/tags/') @session_manager.give_token def get_tags_html(specific_tag=None): if specific_tag is not None: @@ -753,8 +753,8 @@ def get_tags_html(specific_tag=None): ) return response +@site.route('/tag/.json') @site.route('/tags.json') -@site.route('/tags/.json') @session_manager.give_token def get_tags_json(specific_tag=None): if specific_tag is not None: @@ -765,6 +765,11 @@ def get_tags_json(specific_tag=None): tags = [etiquette.jsonify.tag(tag, include_synonyms=include_synonyms) for tag in tags] return jsonify.make_json_response(tags) +@site.route('/tags/') +@site.route('/tags/.json') +def get_tags_specific_redirect(specific_tag=None): + return flask.redirect(request.url.replace('/tags/', '/tag/')) + @site.route('/tags/create_tag', methods=['POST']) @decorators.required_fields(['tagname'], forbid_whitespace=True) def post_tag_create():