mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
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
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user