Skip to content

Commit

Permalink
fix: in case of missing analysis forward to analysis page
Browse files Browse the repository at this point in the history
instead of showing the error page
  • Loading branch information
jstucke committed Dec 16, 2024
1 parent 058e49f commit e52b4b5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/test/unit/web_interface/test_app_show_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def test_app_show_analysis_file_with_preview(self, test_client):

def test_app_show_analysis_invalid_analysis(self, test_client):
result = test_client.get(f'/analysis/{TEST_FW.uid}/this_analysis_does_not_exist/ro/{TEST_FW.uid}').data
assert b'Error!' in result
assert b'The requested analysis (this_analysis_does_not_exist) has not run (yet)' in result

def test_app_single_file_analysis(self, test_client, intercom_task_list):
result = test_client.get(f'/analysis/{TEST_FW.uid}')
Expand Down
5 changes: 2 additions & 3 deletions src/web_interface/components/analysis_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,8 @@ def show_analysis(self, uid, selected_analysis=None, root_uid=None):
if not file_obj:
return render_template('uid_not_found.html', uid=uid)
if selected_analysis is not None and selected_analysis not in file_obj.processed_analysis:
return render_template(
'error.html', message=f'The requested analysis ({selected_analysis}) has not run (yet)'
)
flash(f'The requested analysis ({selected_analysis}) has not run (yet)', 'warning')
selected_analysis = None
if isinstance(file_obj, Firmware):
root_uid = file_obj.uid
other_versions = frontend_db.get_other_versions_of_firmware(file_obj)
Expand Down

0 comments on commit e52b4b5

Please sign in to comment.