From f3e3f6d7f36c26733851aeb6b8103f6c3bd93e03 Mon Sep 17 00:00:00 2001 From: Arash Date: Thu, 26 Sep 2024 16:25:48 +0200 Subject: [PATCH] Fix url_builder --- lib/galaxy/webapps/galaxy/api/library_contents.py | 1 + lib/galaxy/webapps/galaxy/services/library_contents.py | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/webapps/galaxy/api/library_contents.py b/lib/galaxy/webapps/galaxy/api/library_contents.py index 451cb42bc6f5..cace7bbb9ba8 100644 --- a/lib/galaxy/webapps/galaxy/api/library_contents.py +++ b/lib/galaxy/webapps/galaxy/api/library_contents.py @@ -65,6 +65,7 @@ def index( @router.get( "/api/libraries/{library_id}/contents/{id}", + name="library_content", summary="Return a library file or folder.", deprecated=True, ) diff --git a/lib/galaxy/webapps/galaxy/services/library_contents.py b/lib/galaxy/webapps/galaxy/services/library_contents.py index 01f421d15b0a..467e4aa260d3 100644 --- a/lib/galaxy/webapps/galaxy/services/library_contents.py +++ b/lib/galaxy/webapps/galaxy/services/library_contents.py @@ -257,11 +257,16 @@ def _decode_library_content_id( f"Malformed library content id ( {str(content_id)} ) specified, unable to decode." ) - def _url_for(self, trans: ProvidesUserContext, library_id: DecodedDatabaseIdField, id, type): + def _url_for(self, trans: ProvidesUserContext, library_id, id, type): + encoded_library_id = trans.security.encode_id(library_id) encoded_id = trans.security.encode_id(id) if type == "folder": encoded_id = f"F{encoded_id}" - return trans.url_builder("library_content", library_id=library_id, id=encoded_id) if trans.url_builder else None + return ( + trans.url_builder("library_content", library_id=encoded_library_id, id=encoded_id) + if trans.url_builder + else None + ) def _traverse(self, trans: ProvidesUserContext, folder, current_user_roles): admin = trans.user_is_admin