Use request.path instead of url for endswith conditions.

Because of the query string
master
voussoir 2021-01-07 23:04:10 -08:00
parent db63ccc641
commit ca74e2e1d4
2 changed files with 2 additions and 2 deletions

View File

@ -20,7 +20,7 @@ def get_tags_specific_redirect(specific_tag):
@site.route('/tagid/<tag_id>') @site.route('/tagid/<tag_id>')
@site.route('/tagid/<tag_id>.json') @site.route('/tagid/<tag_id>.json')
def get_tag_id_redirect(tag_id): def get_tag_id_redirect(tag_id):
if request.url.endswith('.json'): if request.path.endswith('.json'):
tag = common.P_tag_id(tag_id, response_type='json') tag = common.P_tag_id(tag_id, response_type='json')
else: else:
tag = common.P_tag_id(tag_id, response_type='html') tag = common.P_tag_id(tag_id, response_type='html')

View File

@ -26,7 +26,7 @@ def get_user_json(username):
@site.route('/userid/<user_id>') @site.route('/userid/<user_id>')
@site.route('/userid/<user_id>.json') @site.route('/userid/<user_id>.json')
def get_user_id_redirect(user_id): def get_user_id_redirect(user_id):
if request.url.endswith('.json'): if request.path.endswith('.json'):
user = common.P_user_id(user_id, response_type='json') user = common.P_user_id(user_id, response_type='json')
else: else:
user = common.P_user_id(user_id, response_type='html') user = common.P_user_id(user_id, response_type='html')