xwikisas / macro-pdfviewer

0 stars 4 forks source link

Cannot select or upload a PDF attachment to be displayed on XWiki 14.4 #42

Closed ilieandriuta closed 2 years ago

ilieandriuta commented 2 years ago

Environment: Windows 11 Pro 64bit, Chrome 102, using a local instance of XWiki 14.4, Java 17 (Oracle), PDF Viewer Macro (Pro) 2.4

STEPS TO REPRODUCE

  1. Install PDF Viewer Macro (Pro)
  2. Add a PDF attachment to a page
  3. Edit the page with CKEditor
  4. Click Insert Macros > PDF Viewer
  5. In 'File' box, type the name of the attached file and/or click 'Upload a file ...' to upload a new one
  6. Click 'Submit'

EXPECTED RESULTS

The attached PDF file can be selected and/or a new one uploaded and displayed on the page.

ACTUAL RESULTS

When clicking in the 'File' box (to insert the attached PDF's name or to upload another one), the 'Upload a file ...' does not display, instead there is an endless spinning wheel inside the box.

After the name of the attached PDF is typed, it appears to be selected in the box, but when click 'Submit' the frame of the 'File' box becomes red and nothing happens.

In browser's console there are some errors like:

Uncaught TypeError: Cannot read properties of null (reading 'upload')
    at C.b.settings.render.option_create (<anonymous>:12:274)
    at Selectize.render (selectize.min.js:3:49164)
    at Selectize.refreshOptions (selectize.min.js:3:34029)
    at Selectize.onFocus (selectize.min.js:3:24662)
    at HTMLInputElement.focus (selectize.min.js:3:18448)
    at HTMLInputElement.dispatch (jquery.min.js?r=1:2:43064)
    at v.handle (jquery.min.js?r=1:2:41048)
Uncaught TypeError: Cannot read properties of null (reading 'upload')
    at C.b.settings.render.option_create (<anonymous>:12:274)
    at Selectize.render (selectize.min.js:3:49164)
    at Selectize.refreshOptions (selectize.min.js:3:34029)
    at Selectize.onFocus (selectize.min.js:3:24662)
    at HTMLInputElement.focus (selectize.min.js:3:18448)
    at HTMLInputElement.dispatch (jquery.min.js?r=1:2:43064)
    at v.handle (jquery.min.js?r=1:2:41048)
    at trigger (jquery.min.js?r=1:2:71515)
    at h.event.trigger (eventsBridge.js:30:18)
    at HTMLInputElement.handler (jquery.min.js?r=1:2:40566)

The issue seems to be reproducing only on XWiki 14.4, as it could not be reproduced on XWiki 14.3.1 or 13.10.6.

After clicking in the 'File' box:

image

After typing the name of the attached PDF and clicked 'Submit':

image

mflorea commented 2 years ago

This issue is caused by a regression in XWiki platform (attachment picker) that will be fixed in XWiki 14.4.3+ and 14.6+ . See XWIKI-19940: Can't upload any file or view selected attachment using Office Document Viewer