Title: [230639] trunk
Revision
230639
Author
cdu...@apple.com
Date
2018-04-13 10:37:31 -0700 (Fri, 13 Apr 2018)

Log Message

input.webkitEntries does not work as expected when folder contains accented chars
https://bugs.webkit.org/show_bug.cgi?id=184517
<rdar://problem/39265537>

Reviewed by Alex Christensen.

Source/WebCore:

Use String::fromUTF8() to construct a WTF String from the char* returned by
dirname() in FileSystem::directoryName(). Previously, we were just calling
the String constructor, which would treat the input as latin 1 instead of
UTF-8.

Change is covered by an API test rather than a layout test due to file versioning
limitations.

* platform/posix/FileSystemPOSIX.cpp:
(WebCore::FileSystem::directoryName):

Tools:

Add API test coverage.

* TestWebKitAPI/Tests/WebCore/FileSystem.cpp:
(TestWebKitAPI::TEST_F):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (230638 => 230639)


--- trunk/Source/WebCore/ChangeLog	2018-04-13 17:31:45 UTC (rev 230638)
+++ trunk/Source/WebCore/ChangeLog	2018-04-13 17:37:31 UTC (rev 230639)
@@ -1,3 +1,22 @@
+2018-04-13  Chris Dumez  <cdu...@apple.com>
+
+        input.webkitEntries does not work as expected when folder contains accented chars
+        https://bugs.webkit.org/show_bug.cgi?id=184517
+        <rdar://problem/39265537>
+
+        Reviewed by Alex Christensen.
+
+        Use String::fromUTF8() to construct a WTF String from the char* returned by
+        dirname() in FileSystem::directoryName(). Previously, we were just calling
+        the String constructor, which would treat the input as latin 1 instead of
+        UTF-8.
+
+        Change is covered by an API test rather than a layout test due to file versioning
+        limitations.
+
+        * platform/posix/FileSystemPOSIX.cpp:
+        (WebCore::FileSystem::directoryName):
+
 2018-04-13  Yusuke Suzuki  <utatane....@gmail.com>
 
         [WebCore] Use @getByIdDirectPrivate / @putByIdDirectPrivate in WebCore JS

Modified: trunk/Source/WebCore/platform/posix/FileSystemPOSIX.cpp (230638 => 230639)


--- trunk/Source/WebCore/platform/posix/FileSystemPOSIX.cpp	2018-04-13 17:31:45 UTC (rev 230638)
+++ trunk/Source/WebCore/platform/posix/FileSystemPOSIX.cpp	2018-04-13 17:37:31 UTC (rev 230639)
@@ -351,7 +351,7 @@
     if (!fsRep.data() || fsRep.data()[0] == '\0')
         return String();
 
-    return dirname(fsRep.mutableData());
+    return String::fromUTF8(dirname(fsRep.mutableData()));
 }
 
 Vector<String> listDirectory(const String& path, const String& filter)

Modified: trunk/Tools/ChangeLog (230638 => 230639)


--- trunk/Tools/ChangeLog	2018-04-13 17:31:45 UTC (rev 230638)
+++ trunk/Tools/ChangeLog	2018-04-13 17:37:31 UTC (rev 230639)
@@ -1,3 +1,16 @@
+2018-04-13  Chris Dumez  <cdu...@apple.com>
+
+        input.webkitEntries does not work as expected when folder contains accented chars
+        https://bugs.webkit.org/show_bug.cgi?id=184517
+        <rdar://problem/39265537>
+
+        Reviewed by Alex Christensen.
+
+        Add API test coverage.
+
+        * TestWebKitAPI/Tests/WebCore/FileSystem.cpp:
+        (TestWebKitAPI::TEST_F):
+
 2018-04-13  Thibault Saunier  <tsaun...@igalia.com>
 
         Update my emails ordering in contributors.json

Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/FileSystem.cpp (230638 => 230639)


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/FileSystem.cpp	2018-04-13 17:31:45 UTC (rev 230638)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/FileSystem.cpp	2018-04-13 17:37:31 UTC (rev 230639)
@@ -139,4 +139,12 @@
     EXPECT_EQ(strlen(FileSystemTestData), static_cast<size_t>(targetMetadata.value().length));
 }
 
+TEST_F(FileSystemTest, UnicodeDirectoryName)
+{
+    String path = String::fromUTF8("/test/a\u0308lo/test.txt");
+    String directoryName = FileSystem::directoryName(path);
+    String expectedDirectoryName = String::fromUTF8("/test/a\u0308lo");
+    EXPECT_TRUE(expectedDirectoryName == directoryName);
 }
+
+}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to