Open Bug 1805344 Opened 3 years ago Updated 3 years ago

download-manager retry saves status code 204/4XX/5XX response body to local download folder

Categories

(Firefox :: File Handling, enhancement)

Firefox 107
x86_64
Windows 10
enhancement

Tracking

()

People

(Reporter: wangf1978, Unassigned)

Details

Attachments

(2 files)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0

Steps to reproduce:

  1. Preparing a big zip file, for example, photos.zip, 20MB
  2. Put it to http server side, and write a simple download web page
    <pre>
    <!DOCTYPE html>
    <html>
    <body>
        <a href="photos.zip">Download a zip file</a>
    <body>
    </html>
    </pre>
  3. Download it with FF, and then cancel it before the download is finished
  4. Remove this file from http server
  5. In FF download manager, select the canceled download file, and retry the download

Actual results:

It will download the below response body, and save the below 404 page as "photos.zip"
<pre>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Error response</title>
</head>
<body>
<h1>Error response</h1>
<p>Error code: 404</p>
<p>Message: File not found.</p>
<p>Error code explanation: HTTPStatus.NOT_FOUND - Nothing matches the given URI.</p>
</body>
</html>
</pre>
It is very confused, and let end-user misunderstand that the original file is already downloaded successfully. I also try to modify server response content-type to "application/octet-stream", content-length to "0" or "-1", all does not work even save a photos.zip with zero size.

Expected results:

If the retried download URL response status code is 204/4xx/5xx, not download any file into the local download folder. In the download manager of other browsers, for example, Chrome, it does not save anything to local download folder if the status code is 204/4xx/5xx.

When server responses 204, Chrome and Edge will show "Failed - No file"

In FF, the server side responses 204, and the content-type is "application/octet-stream", and content-length is 0, it saved the file with zero-length in the local download folder successfully.

Here it is expected that FF download manager can keep the same behavior.

Component: Untriaged → Downloads Panel
OS: Unspecified → Windows 10
Hardware: Unspecified → x86_64
Component: Downloads Panel → File Handling
Summary: download-manager retry saves status code 204/404 response body to local download folder → download-manager retry saves status code 204/4XX/5XX response body to local download folder

Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:108.0) Gecko/20100101 Firefox/108.0

Hi,

Thank you for opening this enhancement. I will set this accordingly, as New.

Thanks for your input.

Status: UNCONFIRMED → NEW
Ever confirmed: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: