Title: [263880] trunk/Source/WebCore
Revision
263880
Author
commit-qu...@webkit.org
Date
2020-07-02 20:19:55 -0700 (Thu, 02 Jul 2020)

Log Message

MIMETypeRegistry::getExtensionsForMIMEType() needs to handle wildcard MIME types
https://bugs.webkit.org/show_bug.cgi?id=213826

Patch by Said Abou-Hallawa <sabouhall...@apple.com> on 2020-07-02
Reviewed by Darin Adler.

Addressing post commit review comments for r263832.

* platform/cocoa/MIMETypeRegistryCocoa.mm:
(WebCore::extensionsForMIMETypeMap):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (263879 => 263880)


--- trunk/Source/WebCore/ChangeLog	2020-07-03 02:01:21 UTC (rev 263879)
+++ trunk/Source/WebCore/ChangeLog	2020-07-03 03:19:55 UTC (rev 263880)
@@ -1,3 +1,15 @@
+2020-07-02  Said Abou-Hallawa  <sabouhall...@apple.com>
+
+        MIMETypeRegistry::getExtensionsForMIMEType() needs to handle wildcard MIME types
+        https://bugs.webkit.org/show_bug.cgi?id=213826
+
+        Reviewed by Darin Adler.
+
+        Addressing post commit review comments for r263832.
+
+        * platform/cocoa/MIMETypeRegistryCocoa.mm:
+        (WebCore::extensionsForMIMETypeMap):
+
 2020-07-02  Brady Eidson  <beid...@apple.com>
 
         GameController.framework soft linking refactoring

Modified: trunk/Source/WebCore/platform/cocoa/MIMETypeRegistryCocoa.mm (263879 => 263880)


--- trunk/Source/WebCore/platform/cocoa/MIMETypeRegistryCocoa.mm	2020-07-03 02:01:21 UTC (rev 263879)
+++ trunk/Source/WebCore/platform/cocoa/MIMETypeRegistryCocoa.mm	2020-07-03 03:19:55 UTC (rev 263880)
@@ -46,12 +46,9 @@
             size_t pos = type.reverseFind('/');
 
             ASSERT(pos != notFound);
-            auto wildcardMIMEType = makeString(type.left(pos), "/*"_s);
+            auto wildcardMIMEType = makeString(StringView(type).left(pos), "/*"_s);
 
             for (NSString *extension in extensions) {
-                if (!extension)
-                    continue;
-
                 // Add extension to wildcardMIMEType, for example add "png" to "image/*"
                 addExtension(wildcardMIMEType, extension);
                 // Add extension to its mimeType, for example add "png" to "image/png"
@@ -59,9 +56,9 @@
             }
         };
 
-        auto allUTIs = adoptNS((__bridge NSArray<NSString *> *)_UTCopyDeclaredTypeIdentifiers());
+        auto allUTIs = adoptCF(_UTCopyDeclaredTypeIdentifiers());
 
-        for (NSString *uti in allUTIs.get()) {
+        for (NSString *uti in (__bridge NSArray<NSString *> *)allUTIs.get()) {
             auto type = adoptCF(UTTypeCopyPreferredTagWithClass((__bridge CFStringRef)uti, kUTTagClassMIMEType));
             if (!type)
                 continue;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to