File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed
client/src/components/Panels
galaxy/webapps/galaxy/api Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ function openInteractiveTool(toolId: string) {
118118 <div class =" tool-icon mr-2" >
119119 <img
120120 v-if =" tool.icon"
121- :src =" getAppRoot() + 'api/tools/' + tool.id + '/icon'"
121+ :src =" getAppRoot() + 'api/tools/' + encodeURIComponent( tool.id) + '/icon'"
122122 alt =" tool icon" />
123123 <FontAwesomeIcon v-else :icon =" faTools" size =" 2x" />
124124 </div >
Original file line number Diff line number Diff line change @@ -124,7 +124,7 @@ def fetch_form(
124124 return self .service .create_fetch (trans , payload , files )
125125
126126 @router .get (
127- "/api/tools/{tool_id}/icon" ,
127+ "/api/tools/{tool_id:path }/icon" ,
128128 summary = "Get the icon image associated with a tool" ,
129129 response_class = PNGIconResponse ,
130130 responses = {
Original file line number Diff line number Diff line change @@ -257,6 +257,20 @@ def test_show_output_collection(self):
257257 assert output ["label" ] == "Duplicate List"
258258 assert output ["inherit_format" ] is True
259259
260+ def test_tool_icon_endpoint_with_simple_id (self ):
261+ response = self ._get ("tools/simple_tool_id/icon" )
262+ self ._assert_status_code_is (response , 404 )
263+
264+ def test_tool_icon_endpoint_with_toolshed_id (self ):
265+ # Test complex toolshed tool ID with slashes
266+ toolshed_tool_id = "toolshed.g2.bx.psu.edu/repos/devteam/fastqc/fastqc/0.74+galaxy0"
267+ response = self ._get (f"tools/{ toolshed_tool_id } /icon" )
268+ # We expect either 200 (if tool is installed and has icon) or 404 (if
269+ # not found), but this tests the routing either way.
270+ assert response .status_code in [200 , 404 ]
271+ if response .status_code == 200 :
272+ assert response .headers ["Content-Type" ] == "image/png"
273+
260274 @skip_without_tool ("test_data_source" )
261275 def test_data_source_build_request (self ):
262276 with self .dataset_populator .test_history () as history_id :
You can’t perform that action at this time.
0 commit comments