From 891a82249152040ba38b982c56e6ae140f125746 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Sat, 28 Mar 2026 10:31:40 +0100 Subject: [PATCH] Fix AttributeError when invalid tool ID passed to shed_tool_static Return a 404 instead of crashing with an unhandled AttributeError when toolbox.get_tool() returns None for an invalid/unknown tool GUID. Fixes https://github.com/galaxyproject/galaxy/issues/22126 --- lib/galaxy/webapps/galaxy/controllers/shed_tool_static.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/webapps/galaxy/controllers/shed_tool_static.py b/lib/galaxy/webapps/galaxy/controllers/shed_tool_static.py index 069ff8a8f01..6e88939b2ee 100644 --- a/lib/galaxy/webapps/galaxy/controllers/shed_tool_static.py +++ b/lib/galaxy/webapps/galaxy/controllers/shed_tool_static.py @@ -2,7 +2,10 @@ import logging import os from galaxy import web -from galaxy.exceptions import RequestParameterInvalidException +from galaxy.exceptions import ( + ObjectNotFound, + RequestParameterInvalidException, +) from galaxy.util.path import ( join, safe_contains, @@ -34,6 +37,8 @@ class ShedToolStatic(BaseUIController): """ guid = "/".join((shed, "repos", owner, repo, tool, version)) tool = trans.app.toolbox.get_tool(guid) + if tool is None: + raise ObjectNotFound(f"Could not find tool with guid '{guid}'.") repo_path = os.path.abspath(tool._repository_dir) found_path = None