Skip to content
Snippets Groups Projects
Unverified Commit 2e817d26 authored by Mike McQuaid's avatar Mike McQuaid
Browse files

utils/github: better handle blank scopes.

If both provided and required scopes are blank then we cannot display a
good error message so don't try.

Fixes #6134.
parent 24f5e695
No related branches found
No related tags found
No related merge requests found
......@@ -126,10 +126,13 @@ module GitHub
@api_credentials_error_message ||= begin
unauthorized = (response_headers["http/1.1"] == "401 Unauthorized")
scopes = response_headers["x-accepted-oauth-scopes"].to_s.split(", ")
if unauthorized && scopes.empty?
if unauthorized && scopes.blank?
needed_human_scopes = needed_scopes.join(", ")
needed_human_scopes = "none" if needed_human_scopes.empty?
credentials_scopes = response_headers["x-oauth-scopes"]
return if needed_human_scopes.blank? && credentials_scopes.blank?
needed_human_scopes = "none" if needed_human_scopes.blank?
credentials_scopes = "none" if credentials_scopes.blank?
case GitHub.api_credentials_type
when :keychain
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment