nextcloud/files_pdfviewer

Broken pdf opening on master

juliushaertl opened this issue · 4 comments

Steps to reproduce

  1. Open a PDF file on master 1421fe5

Expected behaviour

File should open

Actual behaviour

File is not opening

Console errors

Content Security Policy: The page’s settings blocked the loading of a resource at eval (“script-src”).
ConsoleLogger.js:33
Uncaught ReferenceError: OC is not defined
    t LoggerBuilder.js:35
    i index.js:19
    <anonymous> logger.js:25
    <anonymous> workersrc.js:97
    <anonymous> workersrc.js:97
LoggerBuilder.js:35:17
Loading Worker from “http://nextcloud.dev.local/index.php/apps/dashboard/” was blocked because of a disallowed MIME type (“text/html”).
[files_pdfviewer](http://nextcloud.dev.local/index.php/apps/files_pdfviewer/?file=http%3A%2F%2Fnextcloud.dev.local%2Fremote.php%2Fdav%2Ffiles%2Fadmin%2FNextcloud_Server_Administration_Manual.pdf&canDownload=1)
Warning: Setting up fake worker. util.js:400:12
Content Security Policy: The page’s settings blocked the loading of a resource at http://nextcloud.dev.local/index.php/apps/build/pdf.worker.js (“script-src”). display_utils.js:462:48
Uncaught (in promise) Error: Setting up fake worker failed: "Cannot load script at: http://nextcloud.dev.local/index.php/apps/build/pdf.worker.js".
    _setupFakeWorker api.js:2233
api.js:2233:10

@skjnldsv @danxuliu I bisected this to be caused by 58d2a50 (the latest pdf.js bump), but noticed that there were newer PRs merged as well, so I was wondering if this may be specific to my setup/browser. Do you also see that error on latest master?

I bisected this to be caused by 58d2a50 (the latest pdf.js bump), but noticed that there were newer PRs merged as well, so I was wondering if this may be specific to my setup/browser. Do you also see that error on latest master?

Yes, I also see the error on latest master. However, 1421fe5^ works for me, so the problem would be caused by the logger bump rather than the PDF.js bump 🤷

Yeah, reverting!

All right, I didn't notice the different errors during bisect (the original was then fixed by #619) Reverting the logger works 👍

This is happening again after the update to nextcloud/logger 2.2.1. Fix is in nextcloud-libraries/nextcloud-logger#383.

Edit: fixed in PDF viewer with #648.