This issue has been created
There are 2 updates.
 
 
XWiki Platform / cid:jira-generated-image-avatar-f3fc753c-f604-4921-a0a3-1d856419ba7c XWIKI-25707 Open

The macro editor doesn't quote the values of a multi-value parameter that contain a separator

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-f41da226-c8d7-472f-bb6f-20d26d1e3ef6 Charpentier Lucas created this issue on 09/Nov/26 17:17
 
Summary: The macro editor doesn't quote the values of a multi-value parameter that contain a separator
Issue Type: cid:jira-generated-image-avatar-f3fc753c-f604-4921-a0a3-1d856419ba7c Bug
Affects Versions: 18.9.0
Assignee: Unassigned
Components: WYSIWYG Editor
Created: 09/Nov/26 17:17
Priority: cid:jira-generated-image-static-major-8a5029c1-cfb2-41e4-87cb-d400e4f7b9df Major
Reporter: Charpentier Lucas
Description:

When a macro parameter is edited with a field that holds several values, such as the multi location picker added by XWIKI-24636, the macro editor writes the parameter by joining the values with a comma, and reads it back by splitting it on commas. Values are never quoted. A value containing a comma or a space is therefore split into several values once the macro runs, since the conversion of a List<...> parameter splits on commas and spaces unless the value is quoted.

Steps to reproduce:

  1. Create a wiki macro with a spaces parameter of type java.util.List<org.xwiki.model.reference.SpaceReference> whose content displays each location on its own line.
  2. Create the locations My Space and Space.My, Page.
  3. Insert the macro in a page with the WYSIWYG editor and pick both locations in the spaces field.
  4. Save and look at the page source and at the macro output.

EXPECTED RESULTS: The macro gets 2 locations, My Space and Space.My, Page. The source holds them quoted, e.g. spaces="\"My Space\",\"Space.My, Page\"", and opening the macro again shows the 2 locations.

ACTUAL RESULTS: The source holds spaces="My Space,Space.My, Page", which the macro gets as 4 locations: My, Space, Space.My and Page. Opening the macro again shows 3 values: My Space, Space.My and Page.

The same happens to an existing quoted value: spaces="'Space.My, Page'" opens as 'Space.My and Page'.

Suggested fix: when joining, put double quotes around each value containing a comma, a whitespace or a quote, escaping }} and {{" inside, which is the syntax AbstractCollectionConverter already parses. When reading, use a quote-aware split instead of split(','). Values without such characters are written exactly as today.

 
 

2 updates

 
cid:jira-generated-image-avatar-f41da226-c8d7-472f-bb6f-20d26d1e3ef6 Changes by Charpentier Lucas on 09/Nov/26 17:17
 
Fix Version: 18.10.0-rc-1
Assignee: Charpentier Lucas