Bug 249134 - Safari does not download attachment when certain filename is used
Summary: Safari does not download attachment when certain filename is used
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: Safari 15
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-12-12 04:15 PST by andregeng
Modified: 2022-12-12 16:43 PST (History)
5 users (show)

See Also:


Attachments
safari open mp4 link inline, instead of download it as attachment (14.65 MB, image/gif)
2022-12-12 04:15 PST, andregeng
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description andregeng 2022-12-12 04:15:51 PST
Created attachment 464008 [details]
safari open mp4 link inline, instead of download it as attachment

we use Content-Disposition header to let browser download mp4 file as attachment. It works inside chrome/firefox etc, but inside safari when the download filename has specific length, safari won't download it as attachment, instead it opens the mp4 file inline inside safari.

Environment: macos Big Sur 11.6.2, Safari 15.5 (16613.2.7.1.9, 16613)

In case it helps, I have pasted the http request&response header messages below: 

GET /space/api/box/stream/download/all/boxcnWKmP2Wpf6CLHMJxLL9Xhpf HTTP/1.1
Host: internal-api-drive-stream.feishu.cn
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 
Connection: keep-alive 
Cookie: 
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.5 Safari/605.1.15 
Accept-Language: zh-cn 
Referer: https://bytedance.feishu.cn/ 
Accept-Encoding: gzip, deflate, br 

HTTP/1.1 200 OK 
Server: Tengine 
Content-Type: video/mp4 
Content-Length: 3289358 
Date: Fri, 25 Nov 2022 02:44:33 GMT 
Accept-Ranges: bytes 
Access-Control-Expose-Headers: Accept-Ranges,Content-Length,access-new-default-thumbnail 
Content-Disposition: attachment; filename="1234567890123456789123456123456123456123456123456123456123456123456123456123456123456123456123456123456.mp4"; filename*=UTF-8''1234567890123456789123456123456123456123456123456123456123456123456123456123456123456123456123456123456.mp4 
X-Request-Id: fd1d0c13-760f-44c0-949b-c3e8b193f290 
X-Tt-Logid: 20221125104433010209158147083F4DEA 
server-timing: inner; 
dur=459 
x-tt-trace-host: 016d5736b1c6a66a108675a2582959e04595c302d84a3fdcd0f0dfde4ae2118cf808ecc5514bea57c8bbbfeb8ff0965fa0af575aa52648a0d3eaf06c3988c7d2d553559e5a284c09ced06ea9969b4762f21b55a57f5b752b6a1e85bcbc5f60c1c2 
x-tt-trace-tag: id=03;cdn-cache=miss;type=dyn 
X-Timestamp: 1669344273.849 
Via: cache17.l2cm9-6[495,0], dynamic6.cn3628[518,0] 
server-timing: cdn-cache;desc=MISS,edge;dur=23,origin;dur=495 
Timing-Allow-Origin: * 
EagleId: 3c1cd8b416693442733623503e 
Connection: keep-alive
Comment 1 Alexey Proskuryakov 2022-12-12 16:42:40 PST
This is curious, I wasn't able to immediately find where the length limit would be, in WebKit or below.
Comment 2 Radar WebKit Bug Importer 2022-12-12 16:43:14 PST
<rdar://problem/103275418>