Bug 160347

Summary: html files downloaded rather than displayed
Product: WebKit Reporter: orbisvicis
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED WORKSFORME    
Severity: Normal CC: bugs-noreply, bugzilla, mcatanzaro
Priority: P2    
Version: Other   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugzilla.gnome.org/show_bug.cgi?id=769312
https://bugs.webkit.org/show_bug.cgi?id=202321
https://bugs.webkit.org/show_bug.cgi?id=239597

Description orbisvicis 2016-07-29 10:53:32 PDT
version: WebKit 2.12.3 from Epiphany 3.20.3

This doctype causes webkit to download the HTML file instead of rendering it in-browser:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

The related epiphany bug (redirects to here):

https://bugzilla.gnome.org/show_bug.cgi?id=769312
Comment 1 orbisvicis 2016-07-29 10:59:56 PDT
All HTML doctypes work, all XHTML doctypes fail.
Comment 2 orbisvicis 2016-07-29 11:07:40 PDT
XHTML doctypes work if the file suffix is ".xhtml" rather than ".html"
Comment 3 Michael Catanzaro 2016-07-29 13:10:07 PDT
I wonder if it could be a regression from https://cgit.freedesktop.org/xdg/shared-mime-info/commit/?id=4961dc3e48d13c0c675ad7c135419b864813ca55
Comment 4 Michael Catanzaro 2016-07-30 09:15:11 PDT
Strange, seems to work fine for me with the same Epiphany and WebKit versions. Did you find any example of a broken site on the Internet? What version of shared-mime-info do you have?
Comment 5 orbisvicis 2016-07-31 09:02:52 PDT
shared-mime-info.x86_64 1.6-1.fc24

This bug report is only applicable to local files (file:///), I forgot to mention. Test files:

#1

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    </head>
    <body>
        <h1>Hello Heading</h1>
        <p>Hello paragraph.</p>
    </body>
</html>

#2

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
    <body>
        <h1>Hello Heading</h1>
        <p>Hello paragraph.</p>
    </body>
</html>
Comment 6 Michael Catanzaro 2016-07-31 14:27:45 PDT
Yeah, both get displayed normally for me... I'm also on F24 with the same shared-mime-info package. I don't know what might account for this difference.
Comment 7 Bastien Nocera 2018-08-21 04:13:52 PDT
The patch in https://bugs.freedesktop.org/show_bug.cgi?id=107637 adds *.html as a glob for XHTML files. The files with this glob should then be differentiated using magic.
Comment 8 Michael Catanzaro 2018-08-21 06:57:09 PDT
(In reply to Bastien Nocera from comment #7)
> The patch in https://bugs.freedesktop.org/show_bug.cgi?id=107637 adds *.html
> as a glob for XHTML files.

OK, so can this bug be closed now?

> The files with this glob should then be
> differentiated using magic.

What does this mean?
Comment 9 Bastien Nocera 2018-08-29 05:17:59 PDT
(In reply to Michael Catanzaro from comment #8)
> (In reply to Bastien Nocera from comment #7)
> > The patch in https://bugs.freedesktop.org/show_bug.cgi?id=107637 adds *.html
> > as a glob for XHTML files.
> 
> OK, so can this bug be closed now?

Up to you, did you test the bug with that shared-mime-info fix?

> > The files with this glob should then be
> > differentiated using magic.
> 
> What does this mean?

That the file type magic will be used to differentiate types with the same glob.
Comment 10 Michael Catanzaro 2018-08-29 07:34:26 PDT
(In reply to Bastien Nocera from comment #9)
> Up to you, did you test the bug with that shared-mime-info fix?

I was never able to reproduce it in the first place.