Bug 202806

Summary: W3C test importer breaks svg files.
Product: WebKit Reporter: Carlos Alberto Lopez Perez <clopez>
Component: Tools / TestsAssignee: Carlos Alberto Lopez Perez <clopez>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, clopez, ews-watchlist, glenn, jbedard, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=137968
Attachments:
Description Flags
Patch none

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>