The PDF Viewer Macro was moved to Java in v2.3 and the PDFViewerMacroParameters is using List<String> as type for the file macro parameter.
#set ($files = $params.files)
The string value provided by the user when calling the macro is converted automatically to a list using the ListConverter which splits the string, by default, using comma or space. This is an unexpected change in behavior. Note that the (default) ListConverter does other "cleanup" (removes { from the start and } from the end, which might lead to other surprises, although having such file names is rare) so I'm not sure it's a good idea to use it. We need to either write / use a custom converter or (probably safer) to make the file parameter a string and to do the split ourselves as before.
BTW, the way we handle the file parameter in PDFViewerMacroParameters is a bit hackish, with setFile (singural) and getFiles (plural). I'm sorry I didn't catch this on review.
This is a regression in v2.3. Before 2.3 the list of files was obtained by splitting the value of the
file
parameter by comma. See https://github.com/xwikisas/macro-pdfviewer/blob/macro-pdfviewer-2.2.1/wiki/src/main/resources/XWiki/PDFViewerMacro.xml#L271The PDF Viewer Macro was moved to Java in v2.3 and the
PDFViewerMacroParameters
is usingList<String>
as type for thefile
macro parameter.The string value provided by the user when calling the macro is converted automatically to a list using the
ListConverter
which splits the string, by default, using comma or space. This is an unexpected change in behavior. Note that the (default)ListConverter
does other "cleanup" (removes{
from the start and}
from the end, which might lead to other surprises, although having such file names is rare) so I'm not sure it's a good idea to use it. We need to either write / use a custom converter or (probably safer) to make thefile
parameter a string and to do the split ourselves as before.BTW, the way we handle the
file
parameter inPDFViewerMacroParameters
is a bit hackish, withsetFile
(singural) andgetFiles
(plural). I'm sorry I didn't catch this on review.