Skip to content

Commit

Permalink
Fix url_builder
Browse files Browse the repository at this point in the history
  • Loading branch information
arash77 committed Sep 26, 2024
1 parent 73c6ddc commit f3e3f6d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/galaxy/webapps/galaxy/api/library_contents.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
9 changes: 7 additions & 2 deletions lib/galaxy/webapps/galaxy/services/library_contents.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f3e3f6d

Please sign in to comment.