[Webkit-unassigned] [Bug 15771] WebKit fails to recognize this file as text/plain and downloads it instead

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Oct 31 10:23:42 PDT 2007


http://bugs.webkit.org/show_bug.cgi?id=15771





------- Comment #8 from ddkilzer at webkit.org  2007-10-31 10:23 PDT -------
(In reply to comment #7)
> I cannot reproduce with a nightly on Leopard. I believe this is
> <rdar://problem/5313523>, fixed in
> <http://trac.webkit.org/projects/webkit/changeset/26758>.

Won't you lose charset information (e.g., "text/plain; charset=utf-8") if you
only return "text/plain" in these cases, or does that not matter in this case?

Index: trunk/WebCore/platform/network/mac/ResourceResponseMac.mm
[...]
+#ifndef BUILDING_ON_TIGER
+        // FIXME: This is part of a workaround for <rdar://problem/5321972>
REGRESSION: Plain text document from HTTP server detected
+        // as application/octet-stream
+        if (m_mimeType == "application/octet-stream") {
+            static const String textPlainMIMEType("text/plain");
+            if
(m_httpHeaderFields.get("Content-Type").startsWith(textPlainMIMEType))
+                m_mimeType = textPlainMIMEType;
+        }
+#endif

Index: trunk/WebKit/WebView/WebDataSource.mm
===================================================================
[...]
+#ifndef BUILDING_ON_TIGER
+- (NSString *)_MIMETypeOfResponse:(NSURLResponse *)response
+{
+    // FIXME: This is part of a workaround for <rdar://problem/5321972>
REGRESSION: Plain text document from HTTP server detected
+    // as application/octet-stream
+    NSString *MIMEType = [response MIMEType];
+    if ([MIMEType isEqualToString:@"application/octet-stream"] && [response
isKindOfClass:[NSHTTPURLResponse class]] && [[[(NSHTTPURLResponse *)response
allHeaderFields] objectForKey:@"Content-Type"] hasPrefix:@"text/plain"])
+        return @"text/plain";
+    return MIMEType;
+}
+#endif


-- 
Configure bugmail: http://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list