Skip to content

Commit

Permalink
Fix crash when file of a result is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
cccs-sgaron committed Sep 1, 2021
1 parent 137d173 commit 6839239
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions assemblyline_ui/api/v4/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,11 @@ def get_service_result(cache_key, **kwargs):
if data is None:
return make_api_response("", "Cache key %s does not exists." % cache_key, 404)

cur_file = STORAGE.file.get(cache_key[:64], as_obj=False)
data = format_result(user['classification'], data, cur_file['classification'], build_hierarchy=True)
cur_file = STORAGE.file.get(cache_key[:64], as_obj=False) or {}
data = format_result(user['classification'],
data,
cur_file.get('classification', CLASSIFICATION.UNRESTRICTED),
build_hierarchy=True)
if not data:
return make_api_response("", "You are not allowed to view the results for this key", 403)

Expand Down

0 comments on commit 6839239

Please sign in to comment.