Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: d496d47f982c0e0c8229b1e66faab7a218ecd2a9
https://github.com/WebKit/WebKit/commit/d496d47f982c0e0c8229b1e66faab7a218ecd2a9
Author: Joanne Pan <[email protected]>
Date: 2026-03-27 (Fri, 27 Mar 2026)
Changed paths:
M
LayoutTests/platform/ios/http/wpt/service-workers/fetch-service-worker-preload-download-through-direct-preload.https-expected.txt
M
LayoutTests/platform/ios/http/wpt/service-workers/fetch-service-worker-preload-download.https-expected.txt
M
LayoutTests/platform/ios/http/wpt/service-workers/fetch-service-worker-preload-use-download-and-clone.https-expected.txt
M
LayoutTests/platform/ios/http/wpt/service-workers/fetch-service-worker-preload-use-download.https-expected.txt
M Source/WebCore/platform/MIMETypeRegistry.cpp
M Source/WebCore/platform/MIMETypeRegistry.h
M Source/WebKit/UIProcess/Downloads/DownloadProxy.cpp
M Tools/TestWebKitAPI/Tests/WebKitCocoa/Download.mm
Log Message:
-----------
"Save as" uses the file extension name instead of the URL Content-Type
https://bugs.webkit.org/show_bug.cgi?id=289445
rdar://147183354
Reviewed by Brent Fulgham.
NSURLResponse.suggestedFilename derives the file extension from the URL path
which
does not match the actual content type sometimes (e.g., a URL ending in .gif
serving video/mp4 produces
a double extension like .gif.mp4). Correct the extension in
DownloadProxy::decideDestinationWithSuggestedFilename by replacing mismatched
extensions
with the correct extension for the response MIME type.
The fix:
- Does not modify filesnames from Content-Disposition headers or download
attributes.
- Skips generic MIME types (e.g., text/plain) because they often are sent from
servers
as fallback when type is unknown.
- Preserves compound extensions like .tar.gz by comparing major MIME types.
Test: Tools/TestWebKitAPI/Tests/WebKitCocoa/Download.mm
*
LayoutTests/platform/ios/http/wpt/service-workers/fetch-service-worker-preload-download-through-direct-preload.https-expected.txt:
*
LayoutTests/platform/ios/http/wpt/service-workers/fetch-service-worker-preload-download.https-expected.txt:
*
LayoutTests/platform/ios/http/wpt/service-workers/fetch-service-worker-preload-use-download-and-clone.https-expected.txt:
*
LayoutTests/platform/ios/http/wpt/service-workers/fetch-service-worker-preload-use-download.https-expected.txt:
* Source/WebCore/platform/MIMETypeRegistry.cpp:
(WebCore::MIMETypeRegistry::correctExtensionForMIMEType):
* Source/WebCore/platform/MIMETypeRegistry.h:
* Source/WebKit/UIProcess/Downloads/DownloadProxy.cpp:
(WebKit::DownloadProxy::decideDestinationWithSuggestedFilename):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/Download.mm:
(TestWebKitAPI::SuggestedFilenameCorrectedByContentType)):
Canonical link: https://commits.webkit.org/310122@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications