xwikisas / macro-pdfviewer

0 stars 4 forks source link

The PDF file isn't shown when it contains a comma in the title #48

Closed ane-gabriela closed 10 months ago

ane-gabriela commented 1 year ago

Steps to reproduce:

  1. Edit a page
  2. Click on Insert > Other macros
  3. Search and select PDF Viewer
  4. Click on "Upload a file..."
  5. Upload the following file Te$t with #special + ch@rs - test. It's ^a test! Test ~1 = and (2) & {3}, [4]. 100% a test 1; 2` 3; 5. and 10 spaces..pdf
  6. Click on Submit
  7. Click on Save & View

Expected results: The document uploaded is shown in the wiki page.

Actual results: Because of the comma , the title of the attachment is separated in 2 separate tabs which results in an error "Error: The file attachment [Te$t with #special + ch@rs - test. It's ^a test! Test ~1 = and (2) & {3}] does not exists in document [xwiki:PDF Viewer.WebHome]." The file isn't shown.

PDFViwer

Environment: Windows 11, XWiki 14.10.10 with MySQL 8.0, Chrome 114, PDF Viewer Macro (Pro) 2.5

petrenkonikita112263 commented 10 months ago

For me it's not the issue, because the macro is using the comma-separated list https://github.com/xwikisas/macro-pdfviewer/blob/937d187bdae046ddfcbbfde3111372c1df9c6b99/api/src/main/resources/templates/pdfviewer/pdfviewer.vm#L150

On my side on latest version 2.5.1 after I'll add call of the macro on test page. Before it I've locally test PDF files "Free_Test_Data_1MB_PDF.pdf" and "Free_Test,Data_1MB_PDF" the code will be

{{pdfviewer file="Free_Test,Data_1MB_PDF.pdf,Free_Test_Data_1MB_PDF.pdf,"/}}

And there're 2 commas - which recognize 3 files in a list.

If replace comma (in code) with something else, issue will be triggered by space or another symbol that will be used in list. That's why OMV it shall be documented that comma isn't allowed in name of PDF file.

Definately, not issue - from page Add more PDF files, separated by comma.