REGRESSION (r199558): File paths selected for upload are stored using the wrong strin...
authoraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Nov 2016 18:52:39 +0000 (18:52 +0000)
committeraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Nov 2016 18:52:39 +0000 (18:52 +0000)
https://bugs.webkit.org/show_bug.cgi?id=164311
<rdar://problem/26995374>

Reviewed by Tim Horton.

-[NSURL fileSystemRepresentation] returns a char* in file system representation, which on
iOS is UTF-8, but we were implicitly converting it to a String, which assumes a char* is
Latin-1 encoded.

* UIProcess/ios/forms/WKFileUploadPanel.mm:
(-[WKFileUploadPanel _chooseFiles:displayString:iconImage:]): Changed to use fromUTF8() to
convert fileURL.fileSystemRepresentation to a String.

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/ios/forms/WKFileUploadPanel.mm

index 07e76cb..dd93b9a 100644 (file)
@@ -1,3 +1,19 @@
+2016-11-02  Andy Estes  <aestes@apple.com>
+
+        REGRESSION (r199558): File paths selected for upload are stored using the wrong string encoding
+        https://bugs.webkit.org/show_bug.cgi?id=164311
+        <rdar://problem/26995374>
+
+        Reviewed by Tim Horton.
+
+        -[NSURL fileSystemRepresentation] returns a char* in file system representation, which on
+        iOS is UTF-8, but we were implicitly converting it to a String, which assumes a char* is
+        Latin-1 encoded.
+
+        * UIProcess/ios/forms/WKFileUploadPanel.mm:
+        (-[WKFileUploadPanel _chooseFiles:displayString:iconImage:]): Changed to use fromUTF8() to
+        convert fileURL.fileSystemRepresentation to a String.
+
 2016-11-02  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         NetworkSession: Network process crash when converting main resource to download
index 473321e..253b8bc 100644 (file)
@@ -342,7 +342,7 @@ static UIImage* iconForFile(NSURL *file)
     Vector<String> filenames;
     filenames.reserveInitialCapacity(count);
     for (NSURL *fileURL in fileURLs)
-        filenames.uncheckedAppend(fileURL.fileSystemRepresentation);
+        filenames.uncheckedAppend(String::fromUTF8(fileURL.fileSystemRepresentation));
 
     NSData *jpeg = UIImageJPEGRepresentation(iconImage, 1.0);
     RefPtr<API::Data> iconImageDataRef = adoptRef(toImpl(WKDataCreate(reinterpret_cast<const unsigned char*>([jpeg bytes]), [jpeg length])));