Title: [213273] trunk/Source/WebCore
Revision
213273
Author
carlo...@webkit.org
Date
2017-03-02 00:59:12 -0800 (Thu, 02 Mar 2017)

Log Message

REGRESSION(r213062): [SOUP] UTF-8 filename in Content-Disposition header incorrectly handled since r213062
https://bugs.webkit.org/show_bug.cgi?id=169024

Reviewed by Youenn Fablet.

This made test http/tests/download/literal-utf-8.html to start failing. The problem is that I removed the
conversion made by String::fromUTF8WithLatin1Fallback that was added in r176930. I removed it because that made
fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-unicode.html to timeout. This patch brings back
the String::fromUTF8WithLatin1Fallback call but only when the header string is 8 bit one.

Fixes: http/tests/download/literal-utf-8.html

* platform/network/soup/ResourceResponseSoup.cpp:
(WebCore::ResourceResponse::platformSuggestedFilename):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (213272 => 213273)


--- trunk/Source/WebCore/ChangeLog	2017-03-02 07:43:41 UTC (rev 213272)
+++ trunk/Source/WebCore/ChangeLog	2017-03-02 08:59:12 UTC (rev 213273)
@@ -1,3 +1,20 @@
+2017-03-01  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        REGRESSION(r213062): [SOUP] UTF-8 filename in Content-Disposition header incorrectly handled since r213062
+        https://bugs.webkit.org/show_bug.cgi?id=169024
+
+        Reviewed by Youenn Fablet.
+
+        This made test http/tests/download/literal-utf-8.html to start failing. The problem is that I removed the
+        conversion made by String::fromUTF8WithLatin1Fallback that was added in r176930. I removed it because that made
+        fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-unicode.html to timeout. This patch brings back
+        the String::fromUTF8WithLatin1Fallback call but only when the header string is 8 bit one.
+
+        Fixes: http/tests/download/literal-utf-8.html
+
+        * platform/network/soup/ResourceResponseSoup.cpp:
+        (WebCore::ResourceResponse::platformSuggestedFilename):
+
 2017-03-01  Alex Christensen  <achristen...@webkit.org>
 
         Actually fix Windows build.

Modified: trunk/Source/WebCore/platform/network/soup/ResourceResponseSoup.cpp (213272 => 213273)


--- trunk/Source/WebCore/platform/network/soup/ResourceResponseSoup.cpp	2017-03-02 07:43:41 UTC (rev 213272)
+++ trunk/Source/WebCore/platform/network/soup/ResourceResponseSoup.cpp	2017-03-02 08:59:12 UTC (rev 213273)
@@ -96,8 +96,13 @@
 
 String ResourceResponse::platformSuggestedFilename() const
 {
+    String contentDisposition(httpHeaderField(HTTPHeaderName::ContentDisposition));
+    if (contentDisposition.isEmpty())
+        return String();
+
+    if (contentDisposition.is8Bit())
+        contentDisposition = String::fromUTF8WithLatin1Fallback(contentDisposition.characters8(), contentDisposition.length());
     SoupMessageHeaders* soupHeaders = soup_message_headers_new(SOUP_MESSAGE_HEADERS_RESPONSE);
-    String contentDisposition(httpHeaderField(HTTPHeaderName::ContentDisposition));
     soup_message_headers_append(soupHeaders, "Content-Disposition", contentDisposition.utf8().data());
     GRefPtr<GHashTable> params;
     soup_message_headers_get_content_disposition(soupHeaders, nullptr, &params.outPtr());
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to