Skip to content

Commit a53c3aa

Browse files
authored
Merge pull request #3670 from chaoss/fix/move_name_keyerror
check for a lack of 200 status when looking up the moved repo name and log it
2 parents 2c19bd1 + 880d919 commit a53c3aa

File tree

1 file changed

+8
-1
lines changed
  • augur/tasks/github/detect_move

1 file changed

+8
-1
lines changed

augur/tasks/github/detect_move/core.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,14 @@ def extract_owner_and_repo_from_endpoint(key_auth, url, logger):
5959
response_from_gh = hit_api(key_auth, url, logger)
6060

6161
page_data = parse_json_response(logger, response_from_gh)
62-
62+
# Note: if parse_json_response fails, it will return a string, causing `in` to do a substring check.
63+
# This may lead to a crash if the field is present but the parsing fails.
64+
if response_from_gh.status_code != 200 or 'full_name' not in page_data:
65+
logger.error(
66+
f"Unexpected response fetching redirect target: status={response_from_gh.status_code}, "
67+
f"url={url}, body={response_from_gh.text}"
68+
)
69+
raise Exception("Could not resolve owner/repo from redirect target due to missing data in the github response")
6370
full_repo_name = page_data['full_name']
6471

6572
splits = full_repo_name.split('/')

0 commit comments

Comments
 (0)