Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do content-sniffing for HTML #566

Closed
The-Compiler opened this issue Mar 18, 2015 · 8 comments
Closed

Do content-sniffing for HTML #566

The-Compiler opened this issue Mar 18, 2015 · 8 comments
Labels
component: downloads Issues related to downloads. priority: 2 - low Issues which are currently not very important.

Comments

@The-Compiler
Copy link
Member

When opening a local HTML file without .html extension, qutebrowser downloads the file instead of opening it.

Instead we should detect it's HTML and open it accordingly.

Ressources:

@The-Compiler
Copy link
Member Author

Fixing this would mean changing qutebrowser.browser.webpage.on_unsupported_content to sniff the reply in the else branch, and then use self.display_content accordingly.

@l29ah
Copy link

l29ah commented Oct 22, 2015

I'd argue that it would make sense to view every file specified on the command line, as it should be much easier to implement and user must be knowing what is he doing when he does this. In fact, he won't ever want to "download" a local file.

@l29ah
Copy link

l29ah commented Oct 22, 2015

// in fact i'm upset that mutt can't view html in qutebrowser because it doesn't append ".html" to the temporary file's name

@The-Compiler
Copy link
Member Author

Fair enough - though it still would need to set some kind of mimetype for them, and I'm not sure if it's a good idea to set text/html for everything local even if it's something completely different.

As a workaround, I think you can write a wrapper script which renames the file and launches qutebrowser on it, and then launch that from mutt.

@spaceone
Copy link

I wouldn't do this. I would always look at the Content-Type response header because this is the correct way to do things.
There is also a unofficial HTTP header X-Content-Type-Options which might have the value nosniff to prevent browsers (IE / Chrome) for doing such thing. Plus the Content-Disposition header should be evaluated.

@The-Compiler
Copy link
Member Author

I don't think local files have HTTP headers 😉

@The-Compiler
Copy link
Member Author

Looks like qutebrowser does the right thing with QtWebEngine here, and I don't want to implement that for QtWebKit only.

@The-Compiler
Copy link
Member Author

Another reason to not do this: Chromium disabled mime sniffing for local files (without .html extension) for security reasons: https://bugs.chromium.org/p/chromium/issues/detail?id=777737

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: downloads Issues related to downloads. priority: 2 - low Issues which are currently not very important.
Projects
None yet
Development

No branches or pull requests

3 participants