Bug 289445

Summary: "Save as" uses the file extension name instead of the URL Content-Type
Product: WebKit Reporter: Jeff Johnson <opendarwin>
Component: MediaAssignee: joanne_pan2
Status: RESOLVED FIXED    
Severity: Normal CC: jer.noble, karlcow, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 18   
Hardware: Mac (Apple Silicon)   
OS: Unspecified   
Attachments:
Description Flags
Screenshot of opening the downloaded video in Finder none

Jeff Johnson
Reported 2025-03-09 18:16:36 PDT
Created attachment 474504 [details] Screenshot of opening the downloaded video in Finder Steps to reproduce: 1) Open https://www.reddit.com/media?url=https%3A%2F%2Fexternal-preview.redd.it%2Fyhb1f6aAABHf5frJUF4mHku3JTgwbg2gl7Wco76dyjA.gif%3Fwidth%3D308%26format%3Dmp4%26s%3D88a3fadf350d2eb9a9c97192a9275c9b3445e979 2) Command-click on the video 3) Select "Download Video" from the contextual menu Expected results: The downloaded video has the file extension .mp4 Actual results: The downloaded video has the file extension .gif As a consequence of this bug, the downloaded video can't be opened. See the attached screenshot. The error dialog says, "It may be damaged or use a file format that Preview doesn't recognize." However, if you simply change the file extension from .gif to .mp4, the video can be played. The .gif file extension comes from the URL, but URLs are arbitrary and meaningless. They may or may not represent an actual file on the web server; that's a private implementation detail. On the other hand, the HTTP response Content-Type header says the URL is video/mp4. Both Chrome and Firefox use the .mp4 file extension rather than the .gif file extension when they download the video.
Attachments
Screenshot of opening the downloaded video in Finder (15.71 KB, image/gif)
2025-03-09 18:16 PDT, Jeff Johnson
no flags
Radar WebKit Bug Importer
Comment 1 2025-03-16 18:17:16 PDT
Karl Dubost
Comment 2 2025-03-16 22:44:42 PDT
The markup is the same in Safari, Firefox and Chrome <video class="m-0 max-h-full max-w-full" autoplay="" playsinline="" muted="" loop="" src="https://external-preview.redd.it/yhb1f6aAABHf5frJUF4mHku3JTgwbg2gl7Wco76dyjA.gif?width=308&amp;format=mp4&amp;s=88a3fadf350d2eb9a9c97192a9275c9b3445e979"> </video> The response is appropriate for all browsers ``` HTTP/2 206 content-type: video/mp4 cache-control: public, max-age=604800 server: snooserv-imo x-imo-features: format=mp4&width=308 via: 1.1 varnish, 1.1 varnish accept-ranges: bytes content-range: bytes 0-16082/16083 date: Mon, 17 Mar 2025 05:37:39 GMT vary: X-Imo-Features,Origin report-to: {"group": "w3-reporting-nel", "max_age": 14400, "include_subdomains": true, "endpoints": [{ "url": "https://w3-reporting-nel.reddit.com/reports" }]}, {"group": "w3-reporting", "max_age": 14400, "include_subdomains": true, "endpoints": [{ "url": "https://w3-reporting.reddit.com/reports" }]}, {"group": "w3-reporting-csp", "max_age": 14400, "include_subdomains": true, "endpoints": [{ "url": "https://w3-reporting-csp.reddit.com/reports" }]} nel: {"report_to": "w3-reporting-nel", "max_age": 14400, "include_subdomains": false, "success_fraction": 0.5, "failure_fraction": 0.5} content-length: 16083 X-Firefox-Spdy: h2 ``` And the "save as" indeed uses the correct file but somehow it picks the URL to determine the filename and the extension for saving the file. https://external-preview.redd.it/yhb1f6aAABHf5frJUF4mHku3JTgwbg2gl7Wco76dyjA.gif changing .gif by .mp4 will fix the right result on the finder.
joanne_pan2
Comment 3 2026-03-25 14:24:30 PDT
joanne_pan2
Comment 4 2026-03-25 15:03:13 PDT
EWS
Comment 5 2026-03-27 17:54:40 PDT
Committed 310122@main (d496d47f982c): <https://commits.webkit.org/310122@main> Reviewed commits have been landed. Closing PR #61355 and removing active labels.
EWS
Comment 6 2026-03-30 14:40:50 PDT
Committed 305413.592@safari-7624-branch (263ee3956e70): <https://commits.webkit.org/305413.592@safari-7624-branch> Reviewed commits have been landed. Closing PR #4851 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.