Title: [214397] trunk/Source/WebCore
Revision
214397
Author
carlo...@webkit.org
Date
2017-03-25 01:20:57 -0700 (Sat, 25 Mar 2017)

Log Message

[XDG] MIMETypeRegistry::getMIMETypeForExtension should return a null/empty string when mime type is unknown
https://bugs.webkit.org/show_bug.cgi?id=170050

Reviewed by Michael Catanzaro.

That's what the callers expect, but we alre always returning XDG_MIME_TYPE_UNKNOWN which is
application/octet-stream.

Fixes: plugins/no-mime-with-valid-extension.html

* platform/xdg/MIMETypeRegistryXdg.cpp:
(WebCore::MIMETypeRegistry::getMIMETypeForExtension):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (214396 => 214397)


--- trunk/Source/WebCore/ChangeLog	2017-03-25 08:19:50 UTC (rev 214396)
+++ trunk/Source/WebCore/ChangeLog	2017-03-25 08:20:57 UTC (rev 214397)
@@ -1,3 +1,18 @@
+2017-03-25  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        [XDG] MIMETypeRegistry::getMIMETypeForExtension should return a null/empty string when mime type is unknown
+        https://bugs.webkit.org/show_bug.cgi?id=170050
+
+        Reviewed by Michael Catanzaro.
+
+        That's what the callers expect, but we alre always returning XDG_MIME_TYPE_UNKNOWN which is
+        application/octet-stream.
+
+        Fixes: plugins/no-mime-with-valid-extension.html
+
+        * platform/xdg/MIMETypeRegistryXdg.cpp:
+        (WebCore::MIMETypeRegistry::getMIMETypeForExtension):
+
 2017-03-24  Myles C. Maxfield  <mmaxfi...@apple.com>
 
         Add font-optical-sizing to CSSComputedStyleDeclaration

Modified: trunk/Source/WebCore/platform/xdg/MIMETypeRegistryXdg.cpp (214396 => 214397)


--- trunk/Source/WebCore/platform/xdg/MIMETypeRegistryXdg.cpp	2017-03-25 08:19:50 UTC (rev 214396)
+++ trunk/Source/WebCore/platform/xdg/MIMETypeRegistryXdg.cpp	2017-03-25 08:20:57 UTC (rev 214397)
@@ -38,8 +38,10 @@
 
     // Build any filename with the given extension.
     String filename = "a." + extension;
-    if (const char* mimeType = xdg_mime_get_mime_type_from_file_name(filename.utf8().data()))
-        return String::fromUTF8(mimeType);
+    if (const char* mimeType = xdg_mime_get_mime_type_from_file_name(filename.utf8().data())) {
+        if (mimeType != XDG_MIME_TYPE_UNKNOWN)
+            return String::fromUTF8(mimeType);
+    }
 
     return String();
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to