Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: aa5783f948506ce7056c3b37e68d31ee78da1d6d
https://github.com/WebKit/WebKit/commit/aa5783f948506ce7056c3b37e68d31ee78da1d6d
Author: Joanne Pan <[email protected]>
Date: 2026-05-28 (Thu, 28 May 2026)
Changed paths:
M Source/WebCore/platform/MIMETypeRegistry.cpp
M Tools/TestWebKitAPI/Tests/WebCore/MIMETypeRegistry.cpp
Log Message:
-----------
Safari "open safe files" turns .tgz files into tarballs without a file
extension (should be .tar; works for .tar.gz)
https://bugs.webkit.org/show_bug.cgi?id=315604
rdar://175291256
Reviewed by Sihui Liu.
The problem: .tgz/.cpgz files were being renamed to .gz/.zip because it
compared the URL extension's MIME type to the server's Content-Type as
plain strings. This ignores the fact that application/x-gzip / application/gzip
(and more) are aliases and that compressed archive shorthands are different
compared to server side. Server side usually labels with just the outer
compression in Content-Type.
The fix: Treat known MIME aliases as equal.
application/x-gzip is normalized to application/gzip (and
application/x-zip-compressed
to application/zip) before comparison to not trigger a false mismatch.
If the URL extension's MIME and the server's MIME are both compressed archive
formats, but are different, we keep the URL extension instead of overwriting it
since the URL is more specfic than the server's label.
Test: Tools/TestWebKitAPI/Tests/WebCore/MIMETypeRegistry.cpp
* Source/WebCore/platform/MIMETypeRegistry.cpp:
(WebCore::canonicalMIMEType):
(WebCore::isArchiveMIMEType):
(WebCore::MIMETypeRegistry::correctExtensionForMIMEType):
* Tools/TestWebKitAPI/Tests/WebCore/MIMETypeRegistry.cpp:
(TestWebKitAPI::TEST(MIMETypeRegistry, CorrectExtensionForMIMEType)):
Canonical link: https://commits.webkit.org/314104@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications