kiwix / kiwix-tools

Command line Kiwix tools: kiwix-serve, kiwix-manage, ...
https://download.kiwix.org/release/kiwix-tools/
GNU General Public License v3.0
407 stars 79 forks source link

Unable to read PDF files from Kiwix-serve #670

Open Popolechien opened 3 months ago

Popolechien commented 3 months ago

It used to be that a user trying to access a PDF file from their mobile phone via Kiwix-serve (either directly from library.kiwix.org or from the hotspot) would be able to read them directly and without problem.

But now trying to check https://library.kiwix.org/viewer#maitre_lucas_completer_les_mots_fr_2023-05/files/compl%C3%A9ter%20les%20mots%205.pdf from my mobile leads to this: Screenshot (21 mars 2024 12_08_12)

Phone is Nothing phone 2 running Android 14 and Google Chrome 122.0.6261.119

kelson42 commented 3 months ago

library.kiwix.org link works fine for me on my android. @rgaudin Do you see anything weird at http response level? Might that be that the problem is that the browser can simply nor handle properly the PDF (within the iframe)?

rgaudin commented 3 months ago

I can reproduce on Chrome/Android but not on Firefox/Android

rgaudin commented 3 months ago
Refused to frame '' because it violates the following Content Security Policy directive: "frame-src 'self'".
viewer.js?cacheid=5fc4badf:282 Uncaught DOMException: Failed to read a named property 'href' from 'Location': Blocked a frame with origin "https://library.kiwix.org" from accessing a cross-origin frame.
    at handle_content_url_change (https://library.kiwix.org/skin/viewer.js?cacheid=5fc4badf:282:62)
    at on_content_load (https://library.kiwix.org/skin/viewer.js?cacheid=5fc4badf:393:5)
    at HTMLIFrameElement.onload (https://library.kiwix.org/viewer#maitre_lucas_completer_les_mots_fr_2023-05/home:77:32)
viewer.js?cacheid=5fc4badf:208 Uncaught TypeError: Cannot read properties of null (reading 'documentElement')
    at updateToolbarVisibilityState (viewer.js?cacheid=5fc4badf:208:24)
Screenshot 2024-03-21 at 14 10 04