From 6839239d04e0ee8259727cde8ff2e3698c3be92f Mon Sep 17 00:00:00 2001 From: Steve Garon Date: Wed, 1 Sep 2021 13:28:37 +0000 Subject: [PATCH] Fix crash when file of a result is missing --- assemblyline_ui/api/v4/result.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/assemblyline_ui/api/v4/result.py b/assemblyline_ui/api/v4/result.py index 4289e4dd..58061d96 100644 --- a/assemblyline_ui/api/v4/result.py +++ b/assemblyline_ui/api/v4/result.py @@ -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)