[GTK] KURL::fileSystemPath() should strip the query of the uri
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 May 2012 06:32:36 +0000 (06:32 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 May 2012 06:32:36 +0000 (06:32 +0000)
https://bugs.webkit.org/show_bug.cgi?id=86721

Reviewed by Martin Robinson.

* platform/gtk/KURLGtk.cpp:
(WebCore::KURL::fileSystemPath): Use the already parsed path to
create the GFile instead of the whole URL string. The parsed path
doesn't include neither the fragment (#) nor the query (?) parts.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@117549 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/gtk/KURLGtk.cpp

index f2c5900..d94f1e5 100644 (file)
@@ -1,3 +1,15 @@
+2012-05-17  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [GTK] KURL::fileSystemPath() should strip the query of the uri
+        https://bugs.webkit.org/show_bug.cgi?id=86721
+
+        Reviewed by Martin Robinson.
+
+        * platform/gtk/KURLGtk.cpp:
+        (WebCore::KURL::fileSystemPath): Use the already parsed path to
+        create the GFile instead of the whole URL string. The parsed path
+        doesn't include neither the fragment (#) nor the query (?) parts.
+
 2012-05-17  Kentaro Hara  <haraken@chromium.org>
 
         [V8][Refactoring] Remove V8Proxy::deletionNotHandledByInterceptor()
index 12d2b18..8d1feac 100644 (file)
@@ -31,7 +31,10 @@ namespace WebCore {
 
 String KURL::fileSystemPath() const
 {
-    GRefPtr<GFile> file = adoptGRef(g_file_new_for_uri(m_string.utf8().data()));
+    if (!isValid() || !isLocalFile())
+        return String();
+
+    GRefPtr<GFile> file = adoptGRef(g_file_new_for_path(path().utf8().data()));
     GOwnPtr<char> filename(g_file_get_path(file.get()));
     return filenameToString(filename.get());
 }