Skip to content
Permalink
Browse files
Fix bug when user-storage request fails but code assumes isDir in the…
… response
  • Loading branch information
machristie committed Sep 28, 2021
1 parent 4b437bf commit fccabee44689295d1ae2c20f14c8c95e701c6582
Showing 1 changed file with 5 additions and 2 deletions.
@@ -321,10 +321,13 @@ def user_file_exists(request, path, storage_resource_id=None, experiment_id=None
path_params={"path": path},
params={"experiment-id": experiment_id},
raise_for_status=False)
if resp.status_code == HTTPStatus.NOT_FOUND or resp.json()['isDir']:
if resp.status_code == HTTPStatus.NOT_FOUND:
return None
resp.raise_for_status()
return resp.json()['files'][0]['dataProductURI']
if resp.json()['isDir']:
return None
else:
return resp.json()['files'][0]['dataProductURI']
final_path, owner_username = _get_final_path_and_owner_username(request, path, experiment_id)
backend = get_user_storage_provider(
request, storage_resource_id=storage_resource_id, owner_username=owner_username)

0 comments on commit fccabee

Please sign in to comment.