RESOLVED FIXED Bug 78339
[GTK] KURL::fileSystemPath() doesn't work if uri contains #
https://bugs.webkit.org/show_bug.cgi?id=78339
Summary [GTK] KURL::fileSystemPath() doesn't work if uri contains #
Carlos Garcia Campos
Reported 2012-02-10 01:52:08 PST
The problem is that KURL::fileSystemPath() uses g_filename_from_uri() to convert the uri to a local path. g_filename_from_uri() doesn't allow uris containing #, returning NULL in that case with a G_CONVERT_ERROR_BAD_URI error. In WebKit2, when html has been loaded from a string with loadHTML(), all relative paths must be relative to the baseURL passed to loadHTML(). To check whether a relative path is in the same directory than the baseURL, both are converted to local path. If the relative path contains a # KURL::fileSystemPath() returns an empty String and the condition is always false, making the web process to terminate. The solution is using GFile instead of g_filename_from_uri(), since GFile removes the anchor from the uri when converting the uri to a local path.
Attachments
Patch (1.67 KB, patch)
2012-02-10 01:56 PST, Carlos Garcia Campos
pnormand: review+
Carlos Garcia Campos
Comment 1 2012-02-10 01:56:21 PST
Created attachment 126477 [details] Patch Implementation with GFile is also bit cleaner and simpler.
Philippe Normand
Comment 2 2012-02-10 03:42:10 PST
Comment on attachment 126477 [details] Patch Looks good!
Carlos Garcia Campos
Comment 3 2012-02-10 03:51:24 PST
Note You need to log in before you can comment on or make changes to this bug.