Skip to content

Commit

Permalink
When issue lists rely on the label model, non-auth users should also get
Browse files Browse the repository at this point in the history
the full list from GitHub, #783
  • Loading branch information
Hallvord R. M. Steen committed Oct 22, 2015
1 parent 502fdc9 commit 41237f6
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions webcompat/api/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,14 +264,10 @@ def get_repo_labels():
Cached for 10 minutes.
'''
if g.user:
request_headers = get_request_headers(g.request_headers)
path = 'repos/{0}/labels'.format(REPO_PATH)
labels = github.raw_request('GET', path, headers=request_headers)
return (labels.content, labels.status_code, get_headers(labels))
else:
# only authed users should be hitting this endpoint
abort(401)
request_headers = get_request_headers(g.request_headers)
path = 'repos/{0}/labels'.format(REPO_PATH)
labels = github.raw_request('GET', path, headers=request_headers)

This comment has been minimized.

Copy link
@miketaylr

miketaylr Oct 22, 2015

Member

This will work as-is, but will count against our server's IP rate limit. Can we follow convention and do a check for g.user and do a proxy_request if non-auth'd? GitHub has bumped @webcompat-bot's rate limit. ⬆️

(I have some ideas for how to clean that up in the future, it's ripe for some refactoring).

return (labels.content, labels.status_code, get_headers(labels))


@api.route('/rate_limit')
Expand Down

0 comments on commit 41237f6

Please sign in to comment.