Bug 239597 - [SOUP] Fails to open local HTML file when it looks too much like an XHTML file
Summary: [SOUP] Fails to open local HTML file when it looks too much like an XHTML file
Status: RESOLVED DUPLICATE of bug 232471
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-04-21 03:25 PDT by Alberto Garcia
Modified: 2023-05-03 07:07 PDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alberto Garcia 2022-04-21 03:25:40 PDT
(this was originally reported in bug 230797)

1. Create a file called /tmp/hello.html with the following contents:

   <!DOCTYPE html>
   <html xmlns="http://www.w3.org/1999/xhtml" style="">
   <head><meta content="text/html; charset=utf-8" http-equiv="Content-Type"></head>
   <body>Hello, world</body>
   </html>

2. Try to open it with MiniBrowser (I'm using WebKitGTK 2.36.0, glib 2.72.0 and libsoup 2.74.2)

   $ /usr/lib/x86_64-linux-gnu/webkit2gtk-4.0/MiniBrowser /tmp/hello.html

3. The following error message appears (because the <meta> tag is not closed):

   "This page contains the following errors:

   error on line 3 at column 81: Opening and ending tag mismatch: meta line 3 and head"

4. Now edit the <html> tag and change the order of the attributes:

   <html style="" xmlns="http://www.w3.org/1999/xhtml">

   This one opens just fine.

Some additional notes:

   * Removing the style attribute results in the same error shown in point 3.
   * WebKit can display the "broken" file just file if it's served over HTTP (likely because of the "Content-type: text/html" header returned by the server)
Comment 1 Michael Catanzaro 2022-04-21 06:22:32 PDT
More relevant discussion: https://gitlab.freedesktop.org/xdg/shared-mime-info/-/issues/98
Comment 2 Michael Catanzaro 2023-05-03 07:07:17 PDT

*** This bug has been marked as a duplicate of bug 232471 ***