Bug 243671

Summary: Zero byte file downloaded when using the download attribute on an <a> element
Product: WebKit Reporter: Terence Eden <webkit.org>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: achristensen, ahmad.saleem792, thorton, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 15   
Hardware: Unspecified   
OS: iOS 15   
Attachments:
Description Flags
Screenshot of the error none

Description Terence Eden 2022-08-08 08:55:09 PDT
Created attachment 461485 [details]
Screenshot of the error

The code:

   <a href="" download="this.html">Download this page</a>`

Should prompt the user to download the current page and save it as a file called "this.html" 

On iOS, a download prompt appears, the file is created, but it is zero bytes. 

Demo: https://shkspr.mobi/blog/2021/08/to-download-this-page-click-here/

Evidence:

* https://twitter.com/pekingspring/status/1556601701603352576
* https://twitter.com/Bari10/status/1556538357353693187
* https://twitter.com/rgarner/status/1556530227676946432
* https://twitter.com/billt/status/1556528760056422401

On MacOS Safari, the file downloads correctly and has the correct file size.

(I've also raised this as FB11144571 on Feedback Assistant - because I wasn't sure if it was an iOS or WebKit bug.)
Comment 1 Alexey Proskuryakov 2022-08-10 17:53:37 PDT
rdar://98320652
Comment 2 Ahmad Saleem 2022-11-01 01:46:12 PDT
Is this Commit related to this?

https://github.com/WebKit/WebKit/pull/5489