Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

Commit f7b17c1

Browse files
MIMETypeRegistry::getExtensionsForMIMEType() needs to handle wildcard MIME types
https://bugs.webkit.org/show_bug.cgi?id=213826 Patch by Said Abou-Hallawa <[email protected]> on 2020-07-02 Reviewed by Darin Adler. Addressing post commit review comments for r263832. * platform/cocoa/MIMETypeRegistryCocoa.mm: (WebCore::extensionsForMIMETypeMap): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@263880 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 469bfef commit f7b17c1

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

Source/WebCore/ChangeLog

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
2020-07-02 Said Abou-Hallawa <[email protected]>
2+
3+
MIMETypeRegistry::getExtensionsForMIMEType() needs to handle wildcard MIME types
4+
https://bugs.webkit.org/show_bug.cgi?id=213826
5+
6+
Reviewed by Darin Adler.
7+
8+
Addressing post commit review comments for r263832.
9+
10+
* platform/cocoa/MIMETypeRegistryCocoa.mm:
11+
(WebCore::extensionsForMIMETypeMap):
12+
113
2020-07-02 Brady Eidson <[email protected]>
214

315
GameController.framework soft linking refactoring

Source/WebCore/platform/cocoa/MIMETypeRegistryCocoa.mm

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,19 @@
4646
size_t pos = type.reverseFind('/');
4747

4848
ASSERT(pos != notFound);
49-
auto wildcardMIMEType = makeString(type.left(pos), "/*"_s);
49+
auto wildcardMIMEType = makeString(StringView(type).left(pos), "/*"_s);
5050

5151
for (NSString *extension in extensions) {
52-
if (!extension)
53-
continue;
54-
5552
// Add extension to wildcardMIMEType, for example add "png" to "image/*"
5653
addExtension(wildcardMIMEType, extension);
5754
// Add extension to its mimeType, for example add "png" to "image/png"
5855
addExtension(type, extension);
5956
}
6057
};
6158

62-
auto allUTIs = adoptNS((__bridge NSArray<NSString *> *)_UTCopyDeclaredTypeIdentifiers());
59+
auto allUTIs = adoptCF(_UTCopyDeclaredTypeIdentifiers());
6360

64-
for (NSString *uti in allUTIs.get()) {
61+
for (NSString *uti in (__bridge NSArray<NSString *> *)allUTIs.get()) {
6562
auto type = adoptCF(UTTypeCopyPreferredTagWithClass((__bridge CFStringRef)uti, kUTTagClassMIMEType));
6663
if (!type)
6764
continue;

0 commit comments

Comments
 (0)