Skip to content

Commit b6c9a63

Browse files
committed
Issue webcompat#1120 - Add status code 301 and redirect url for /issues/category/new to /issues/category/needstriage, /issues/search/new to /issues/search/needtriage
1 parent 7ec19fd commit b6c9a63

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

webcompat/api/endpoints.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414
from flask import abort
1515
from flask import Blueprint
1616
from flask import g
17+
from flask import redirect
1718
from flask import request
1819
from flask import session
20+
from flask import url_for
1921

2022
from webcompat import app
2123
from webcompat import limiter
@@ -128,7 +130,8 @@ def get_issue_category(issue_category):
128130
# For paginated results on the /issues page,
129131
# see /issues/search/needstriage.
130132
elif issue_category == 'new':
131-
abort(301)
133+
redirect(url_for('.get_issue_category',
134+
issue_category='needstriage'), 301)
132135
else:
133136
# The path doesn’t exist. 404 Not Found.
134137
abort(404)
@@ -189,7 +192,8 @@ def get_category_from_search(issue_category):
189192
query_string += ' state:closed '
190193
return get_search_results(query_string, params)
191194
elif issue_category == 'new':
192-
abort(301)
195+
redirect(url_for('.get_category_from_search',
196+
issue_category='needstriage'), 301)
193197
else:
194198
# no known keyword we send not found
195199
abort(404)

0 commit comments

Comments
 (0)