Skip to content

Commit

Permalink
Merge pull request #258 from CybercentreCanada/hotfix/expiry_issues
Browse files Browse the repository at this point in the history
Fix crash when file of a result is missing
  • Loading branch information
cccs-sgaron authored Sep 2, 2021
2 parents c8880cc + 6839239 commit 186a6d3
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 186a6d3

Please sign in to comment.