Title: [107395] trunk/Source/WebCore
Revision
107395
Author
carlo...@webkit.org
Date
2012-02-10 03:51:05 -0800 (Fri, 10 Feb 2012)

Log Message

[GTK] KURL::fileSystemPath() doesn't work if uri contains #
https://bugs.webkit.org/show_bug.cgi?id=78339

Reviewed by Philippe Normand.

* platform/gtk/KURLGtk.cpp:
(WebCore::KURL::fileSystemPath): Use GFile API instead of
g_filename_from_uri() to convert the uri to a local
path. g_file_get_path() removes the anchor from the uri and
returns a valid path instead of NULL.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (107394 => 107395)


--- trunk/Source/WebCore/ChangeLog	2012-02-10 11:46:28 UTC (rev 107394)
+++ trunk/Source/WebCore/ChangeLog	2012-02-10 11:51:05 UTC (rev 107395)
@@ -1,3 +1,16 @@
+2012-02-10  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        [GTK] KURL::fileSystemPath() doesn't work if uri contains #
+        https://bugs.webkit.org/show_bug.cgi?id=78339
+
+        Reviewed by Philippe Normand.
+
+        * platform/gtk/KURLGtk.cpp:
+        (WebCore::KURL::fileSystemPath): Use GFile API instead of
+        g_filename_from_uri() to convert the uri to a local
+        path. g_file_get_path() removes the anchor from the uri and
+        returns a valid path instead of NULL.
+
 2012-02-10  Pablo Flouret  <pab...@motorola.com>
 
         CodeGeneratorJS doesn't always generate visitChildren() implementation when required

Modified: trunk/Source/WebCore/platform/gtk/KURLGtk.cpp (107394 => 107395)


--- trunk/Source/WebCore/platform/gtk/KURLGtk.cpp	2012-02-10 11:46:28 UTC (rev 107394)
+++ trunk/Source/WebCore/platform/gtk/KURLGtk.cpp	2012-02-10 11:51:05 UTC (rev 107395)
@@ -20,6 +20,9 @@
 #include "KURL.h"
 
 #include "FileSystem.h"
+#include <gio/gio.h>
+#include <wtf/gobject/GOwnPtr.h>
+#include <wtf/gobject/GRefPtr.h>
 #include <wtf/text/CString.h>
 
 #include <glib.h>
@@ -28,13 +31,9 @@
 
 String KURL::fileSystemPath() const
 {
-    gchar* filename = g_filename_from_uri(m_string.utf8().data(), 0, 0);
-    if (!filename)
-        return String();
-
-    String path = filenameToString(filename);
-    g_free(filename);
-    return path;
+    GRefPtr<GFile> file = adoptGRef(g_file_new_for_uri(m_string.utf8().data()));
+    GOwnPtr<char> filename(g_file_get_path(file.get()));
+    return filenameToString(filename.get());
 }
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to