New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 758094 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 2
Type: Bug



Sign in to add a comment

Extension can not rename downloaded file

Reported by berkut.u...@gmail.com, Aug 23 2017

Issue description

UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36

Example URL:

Steps to reproduce the problem:
1. Create file "manifest.json":
{
  "manifest_version": 2,
  "name": "Extension name",
  "version": "0",
  "minimum_chrome_version": "31",
  "background": {
    "persistent": false,
    "scripts": [ "event_page.js" ]
  },
  "permissions": [
    "downloads",
    "https://example.com/*"
  ]
}

2. Create file "event_page.js":
chrome.downloads.onDeterminingFilename.addListener(
  (download_item, suggest) =>
  {
    suggest(
      {
        conflictAction: "uniquify",
        filename: "article_id.html"
      }
    );
  }
);
chrome.downloads.download(
  {
    url: "https://example.com/get.php?q=article_id",
    filename: "article_id.html",
    conflictAction: "uniquify",
    saveAs: false
  }
);

3. Create chrome extension.
4. Extension will send request to server "example.com".
5. Server will send response to browser with header like:
Content-Disposition; attachment; filename="article_id.html"; filename*=UTF-8''extremely%20long%20localized%20file%20name%20based%20on%20article%20title.html
Length of server proposed UTF-8 file name in bytes larger then file system path length limit.

What is the expected behavior?
If there are extension proposed file name ("filename"), never use server proposed file name and try to use extension proposed "filename"; if "saveAs:true", show dialog "Save as", pre-populated with the extension proposed "filename"; if "saveAs:false", do not show dialog; if "conflictAction" specified, use it (auto rename, overwrite or show "Save as" dialog, pre-populated with the extension proposed "filename"); if previously steps failed, show "Save as" dialog.

What went wrong?
"Save as" dialog displayed for each request (short "filename", "saveAs:false" and "conflictAction" always ignored). Extension's function "chrome.downloads.download()" and handler of event "chrome.downloads.onDeterminingFilename" can not rename file.

Did this work before? N/A 

Chrome version: 60.0.3112.101  Channel: stable
OS Version: Ubuntu 16.04
Flash Version:
 

Comment 1 by mmenke@chromium.org, Aug 23 2017

Components: -Internals>Network UI>Browser>Downloads Platform>Extensions>API
Cc: krajshree@chromium.org
Labels: Needs-Triage-M60 Needs-Feedback
Reporter@ - Thanks for filing the issue...!!

Could you please provide a sample extension file to test the issue from TE-end. This will help us in triaging the issue further.
Also if possible please provide a screen cast or screen shot explaining the issue.

Thanks...!!
Owner: qin...@chromium.org
Min can you take a look?
Status: Assigned (was: Unconfirmed)

Sign in to add a comment