This issue has been created
 
 
XWiki Platform / cid:jira-generated-image-avatar-18247253-33b5-4ff0-bc93-8475e6c5f22a XWIKI-25581 Open

Report the invalid values of the attachmentGalleryPicker and attachmentSelector macros instead of showing nothing

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-884febb0-bada-4e9d-8f68-c54035eb731a Charpentier Lucas created this issue on 23/Oct/26 17:13
 
Summary: Report the invalid values of the attachmentGalleryPicker and attachmentSelector macros instead of showing nothing
Issue Type: cid:jira-generated-image-avatar-18247253-33b5-4ff0-bc93-8475e6c5f22a Improvement
Affects Versions: 17.10.14, 18.8.0
Assignee: Unassigned
Components: Attachments
Created: 23/Oct/26 17:13
Priority: cid:jira-generated-image-static-major-861bac39-bb59-40e6-8874-b461a2930833 Major
Reporter: Charpentier Lucas
Description:

The attachment picker macros accept a target page, a class, a property and an object that may not exist. When one is wrong, they show nothing, "No result." or an unrelated message, so the user cannot tell what to fix.

The macros to change, with the file where most of the fix is done:

The main problems:

  • attachmentGalleryPicker: a negative limit gives the notification "The attachments search query failed.", an unknown filter shows "No result.", and a target page that does not exist shows "No result." for the current page, with no message about the page.
  • attachmentSelector: a class, a property or a target page that does not exist displays nothing, an object number that does not exist shows nothing, or silently the first object for object="abc", and a defaultValue that is not an attachment is shown as an attachment name. Only a missing classname gives a message naming the parameter.

The fix is to check the target page, class, property and object before showing the picker, and to show an error naming the parameter when one does not exist.

Depends on

  • XCOMMONS-3847, which refuses the boolean and number values that do not convert.
  • XRENDERING-823, which makes the error of an invalid parameter name the parameter and the expected value.
  • XWIKI-25197, which lets a wiki macro parameter declare a range or a format, checked when the macro runs.

KOs covered

Macro Criterion Problem
attachmentGalleryPicker E2 errors limit="-3" shows an empty picker and "The attachments search query failed.", filter="pictures" shows "No result.", and target="NoSuch.Page" shows "No result." for the current page, with no message about the page. Partly covered, see below.
attachmentSelector E2 errors A class, a property or a targetdocname that does not exist displays nothing, object="abc" silently shows the first object and object="99" nothing, and a defaultValue that is not an attachment is shown as its name, all with no message. Partly covered, see below.

Impact found on macro fluidity

These 2 KOs come from the WYSIWYG usability audit of the macros, under the criterion E2 errors of its usability criteria, which asks that an invalid parameter value produces a message that says what is wrong and how to fix it, not a stack trace. The page of each macro, linked in the table, has the full notes and the steps to reproduce.

Each of these KOs is only partly covered here, for the problems specific to the macro. The same KOs also report invalid values that the macro system handles for every macro: XCOMMONS-3847 refuses the booleans and numbers that do not convert, and XRENDERING-823 makes the error name the parameter and the expected value. The number and format constraints, like width, height and filter, are covered by XWIKI-25197.