min icon indicating copy to clipboard operation
min copied to clipboard

PDF files no longer open properly

Open sage-etcher opened this issue 1 year ago • 2 comments

  • Min Version: 1.31.1
  • Operating system: Windows 10

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.

sage-etcher avatar Jan 25 '24 18:01 sage-etcher

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).

PalmerAL avatar Feb 24 '24 20:02 PalmerAL