diff --git a/commands/edit_entry/git_utils.py b/commands/edit_entry/git_utils.py index 7aecd92..9db870d 100644 --- a/commands/edit_entry/git_utils.py +++ b/commands/edit_entry/git_utils.py @@ -63,7 +63,7 @@ def create_pull_request( commit_msg=f"Modified translation for: lang={lang}, entry_id={entry_id}, field={field}", new_contents=new_json_contents_str, ) - except UnknownObjectException: + except (UnknownObjectException, AttributeError): # file doesn't exist, create and commit a new one # ! Note that this immediately commits the new file! json_file = WEBSITE_REPO.create_file( diff --git a/commands/edit_entry/github_pullrequest.py b/commands/edit_entry/github_pullrequest.py index 984ad2f..3fd7746 100644 --- a/commands/edit_entry/github_pullrequest.py +++ b/commands/edit_entry/github_pullrequest.py @@ -23,9 +23,9 @@ async def modify_json_and_create_pull_request( # * take the english version and blank everything out if not the_file: the_json = await get_blank_json() - - # * at this point, it's a valid json - the_json = json.loads(the_file.decoded_content.decode()) + else: + # * at this point, it's a valid json + the_json = json.loads(the_file.decoded_content.decode()) # print("Modifying the json to reflect the changes...") if field == "links": proposed_text = process_list(proposed_text)