This issue has been created
 
 
XWiki Platform / cid:jira-generated-image-avatar-23aced6e-71ef-449f-9ce2-acc76251ee03 XWIKI-24557 Open

The icon picker fails to load the icons if the wiki has no default icon theme selected

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-cb0f8676-affa-426c-853e-d795294bc9fa Marius Dumitru Florea created this issue on 08/Jul/26 14:48
 
Summary: The icon picker fails to load the icons if the wiki has no default icon theme selected
Issue Type: cid:jira-generated-image-avatar-23aced6e-71ef-449f-9ce2-acc76251ee03 Bug
Affects Versions: 17.10.9, 18.4.2
Assignee: Unassigned
Components: Icon
Created: 08/Jul/26 14:48
Priority: cid:jira-generated-image-static-major-1d3c0e91-1a69-47aa-83c5-a162d83cc4db Major
Reporter: Marius Dumitru Florea
Description:

Steps to reproduce:

  • Go to "Wiki Administration > Look & Feel > Themes" and select "---" for the Icon Theme. I suppose this means "Use the default value", i.e. don't set any explicit value, use whatever is the default. Save and reload the page. Notice that the XWiki UI is now using the Silk icon theme. It doesn't matter if it's Silk or something else. What's important is that icons are still displayed, from a default icon theme, whatever that may be.
  • Go to "Wiki Administration > Content > Page Template" and start creating a new page template
  • Try to set the template icon. Notice that the icon picker fails to load the icons.

The REST API return:

{"iconThemes":["Font Awesome","Silk"],"currentIconTheme":null}

And thus the icon picker tries to load the icon from

/xwiki/bin/get/IconThemesCode/IconPicker?outputSyntax=plain&action=data_icons&iconTheme=null

which throws:

Failed to execute the [velocity] macro. Cause: [Cannot invoke "org.xwiki.icon.IconSet.getIconNames()" because the return value of "org.xwiki.icon.IconSetManager.getIconSet(String)" is null

This breaks the JavaScript code:

Uncaught TypeError: can't access property "length", icons[currentIconTheme] is undefined

Having no explicit icon theme selected is not common, but it happens in functional tests. Nevertheless, we should bulletproof the icon picker code to work even when there is not icon theme selected explicitly.