api: Fix showing icons for custom shortcuts

Tests:

- Add a custom shortcut and provide a custom icon for it in
/var/www/plinth/custom/static/icons/. Visit the page /plinth/api/1/shortcuts/.
The icon path for the custom shortcut is correct and accessible from browser.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2025-09-17 16:27:06 -07:00 committed by James Valleroy
parent 729690792f
commit 2862862161
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -65,6 +65,9 @@ def _get_icon_url(app_id, icon_name):
if not icon_name:
return None
if icon_name.startswith('/'):
return icon_name
if app_id:
return static(f'{app_id}') + f'/icons/{icon_name}.png'