minbrowser / min

A fast, minimal browser that protects your privacy
https://minbrowser.org/
Apache License 2.0
7.71k stars 684 forks source link

PDF files no longer open properly #2375

Open sage-etcher opened 5 months ago

sage-etcher commented 5 months ago

Expected Behavior

Opening a local pdf file with Min should let you view the file.

Actual Behavior

Instead, the browser instantly prompts to save the file, upon canceling the download the file never loads.

To Reproduce

Open a locally saved pdf file using Min.

PalmerAL commented 4 months ago

I looked into this a bit, and this is a result of 9efaf3bca9578f4471cdcd9cb16419d77cabe303. Specifically, this doesn't work: https://github.com/minbrowser/min/blob/master/main/download.js#L102 because Chromium blocks fetch calls to local files before we ever get a response.

We probably need to add a custom method for the PDF viewer to read local files. We need to be careful to do this in a secure way though (ie we need to ensure that requests really come from the PDF viewer so we don't accidentally expose this capability to other pages).