Bug 243671 - Zero byte file downloaded when using the download attribute on an <a> element
Summary: Zero byte file downloaded when using the download attribute on an <a> element
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: Safari 15
Hardware: Unspecified iOS 15
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-08-08 08:55 PDT by Terence Eden
Modified: 2022-11-01 01:46 PDT (History)
4 users (show)

See Also:


Attachments
Screenshot of the error (26.81 KB, image/jpeg)
2022-08-08 08:55 PDT, Terence Eden
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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