Bug 202806 - W3C test importer breaks svg files.
Summary: W3C test importer breaks svg files.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Carlos Alberto Lopez Perez
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-10-10 10:43 PDT by Carlos Alberto Lopez Perez
Modified: 2019-11-13 06:56 PST (History)
7 users (show)

See Also:


Attachments
Patch (2.65 KB, patch)
2019-10-10 10:52 PDT, Carlos Alberto Lopez Perez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos Alberto Lopez Perez 2019-10-10 10:43:38 PDT
The WebKit W3C importer tries to rewrite the xml/html/css files when importing them to rewrite paths and such.

The issue is that to decide if rewrite the file or not uses the mimetype and the current code just checks for something like
if "xml" in str(mimetype[0])

but svg files have mimetype image/svg+xml so the above becomes true and it tries to rewrite a svg file breaking it.
Comment 1 Carlos Alberto Lopez Perez 2019-10-10 10:52:37 PDT
Created attachment 380658 [details]
Patch
Comment 2 Jonathan Bedard 2019-10-10 12:18:09 PDT
Comment on attachment 380658 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=380658&action=review

> Tools/Scripts/webkitpy/w3c/test_importer.py:514
> +                    _log.info("Rewriting: %s" % new_filepath)

Can we use .format strings? % encoding doesn't work in Python 3
Comment 3 Carlos Alberto Lopez Perez 2019-10-10 12:56:03 PDT
(In reply to Jonathan Bedard from comment #2)
> Comment on attachment 380658 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=380658&action=review
> 
> > Tools/Scripts/webkitpy/w3c/test_importer.py:514
> > +                    _log.info("Rewriting: %s" % new_filepath)
> 
> Can we use .format strings? % encoding doesn't work in Python 3

I think it does work in python3 without issue.

$ python3 -c 'var="world"; print("Hello %s" % var)'
Hello world
Comment 4 Jonathan Bedard 2019-10-10 13:01:16 PDT
(In reply to Carlos Alberto Lopez Perez from comment #3)
> (In reply to Jonathan Bedard from comment #2)
> > Comment on attachment 380658 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=380658&action=review
> > 
> > > Tools/Scripts/webkitpy/w3c/test_importer.py:514
> > > +                    _log.info("Rewriting: %s" % new_filepath)
> > 
> > Can we use .format strings? % encoding doesn't work in Python 3
> 
> I think it does work in python3 without issue.
> 
> $ python3 -c 'var="world"; print("Hello %s" % var)'
> Hello world

You're totally right...not sure why I thought that didn't work in Python3.
Comment 5 Carlos Alberto Lopez Perez 2019-10-10 14:58:02 PDT
Comment on attachment 380658 [details]
Patch

Clearing flags on attachment: 380658

Committed r250992: <https://trac.webkit.org/changeset/250992>
Comment 6 Carlos Alberto Lopez Perez 2019-10-10 14:58:06 PDT
All reviewed patches have been landed.  Closing bug.
Comment 7 Radar WebKit Bug Importer 2019-10-10 14:59:17 PDT
<rdar://problem/56170891>