Rob--W / open-in-browser

A browser extension that offers the ability to open files directly in the browser instead of downloading them.
Other
83 stars 15 forks source link

Empty content type shows dialog #61

Open Mathnerd314 opened 4 years ago

Mathnerd314 commented 4 years ago

This article seems to have an empty content type header: http://kyleprifogle.com/dear-startup/. Open in Browser pops up a dialog for it.

I guess this is solved by implementing content sniffing as in #5? Or is there an easier solution?

Rob--W commented 4 years ago

If you'd like to not see a dialog when the type is empty, choose the "Open with" option and then "remember choice". If you do encounter a file that you want to be downloaded anyway, then you can use "Tools" menu > "Open in Browser" > "Enable for next request" to force the dialog to appear anyway, despite the default choice.

Not ideal, but the alternative (implementing MIME sniffing) is more complicated.

(this is the same "bug" as #32)

est31 commented 3 years ago

One could try extracting the servo MIME sniffer into a separate crate and compile it to wasm.

Rob--W commented 3 years ago

The problem is not the sniffing logic itself, but the ability to use the response body twice: once to sniff, and once more to stream the original response. There is currently no side-effect free way of performing content sniffing AND changing the content type. #5 has more details on my last attempt.