Skip to content

Commit

Permalink
Fixing GitHub #19 - key error if domain doesn't exist.
Browse files Browse the repository at this point in the history
  • Loading branch information
maxpearl committed Jan 13, 2021
1 parent cc2b5a7 commit cc7e7bc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
12 changes: 6 additions & 6 deletions bcapp/flaskapp/mirror_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ def mirror_detail(**kwargs):
output['domain'] = domain
domain_data = check(domain)
exists = domain_data['exists']
current_mirrors = domain_data['available_mirrors']
current_onions = domain_data['available_onions']
current_ipfs_nodes = domain_data['available_ipfs_nodes']
current_alternatives = domain_data['available_alternatives']

if not exists:
if exists:
current_mirrors = domain_data['available_mirrors']
current_onions = domain_data['available_onions']
current_ipfs_nodes = domain_data['available_ipfs_nodes']
current_alternatives = domain_data['available_alternatives']
else:
if kwargs['mode'] == 'console':
print(f"{domain} doesn't exist in the mirror list.")
return False
Expand Down
5 changes: 3 additions & 2 deletions bcapp/flaskapp/repo_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,9 @@ def check(url):
'available_ipfs_nodes': available_ipfs_nodes,
'available_alternatives': available_alternatives
}

return {"alternatives" : 'None'}

# No match
return {"exists": False, "alternatives" : 'None'}

def convert_all():
"""
Expand Down

0 comments on commit cc7e7bc

Please sign in to comment.