From 815f86f7fc6865ad8d67eb79e4aba1fb3b43dbe7 Mon Sep 17 00:00:00 2001 From: Martin Cech Date: Thu, 26 Mar 2015 14:47:57 -0400 Subject: [PATCH] catch malformed ids in the API controller --- lib/galaxy/webapps/tool_shed/api/repositories.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/webapps/tool_shed/api/repositories.py b/lib/galaxy/webapps/tool_shed/api/repositories.py index a29dbfe9e16..92fb87f519f 100644 --- a/lib/galaxy/webapps/tool_shed/api/repositories.py +++ b/lib/galaxy/webapps/tool_shed/api/repositories.py @@ -14,6 +14,7 @@ from galaxy.exceptions import RequestParameterMissingException from galaxy.exceptions import RequestParameterInvalidException from galaxy.exceptions import ActionInputError from galaxy.exceptions import ObjectNotFound +from galaxy.exceptions import MalformedId from galaxy.datatypes import checkers from galaxy.model.orm import and_ from galaxy.web import _future_expose_api as expose_api @@ -577,8 +578,13 @@ class RepositoriesController( BaseAPIController ): :returns: detailed repository information :rtype: dict - :raises: ObjectNotFound + :raises: ObjectNotFound, MalformedId """ + try: + trans.security.decode_id( id ) + except Exception: + raise MalformedId( 'The given id is invalid.' ) + repository = suc.get_repository_in_tool_shed( trans.app, id ) if repository is None: raise ObjectNotFound( 'Unable to locate repository for the given id.' )