Skip to content

browser: provide a default filename when unable to generate from download data#7169

Merged
zcbenz merged 3 commits intoelectron:masterfrom
deepak1556:download_defaultname_patch
Sep 16, 2016
Merged

browser: provide a default filename when unable to generate from download data#7169
zcbenz merged 3 commits intoelectron:masterfrom
deepak1556:download_defaultname_patch

Conversation

@deepak1556
Copy link
Copy Markdown
Member

Also we didn't handle alt+click on links with no download attribute, chrome downloads for that gesture but we generate a new-window event. This patch fixes it in a separate commit, can be reverted if not desired.

Fixes #7151

content::WebContents* WebContents::OpenURLFromTab(
content::WebContents* source,
const content::OpenURLParams& params) {
if (params.disposition == SAVE_TO_DISK) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes current behavior and not all users want to have the ability download things from the app, we can probably just make it explicit in the new-window event and document it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, thanks!

@deepak1556 deepak1556 force-pushed the download_defaultname_patch branch from 346e8b8 to e7f1265 Compare September 16, 2016 11:00
@zcbenz zcbenz merged commit 9dad947 into electron:master Sep 16, 2016
@kevinsawicki
Copy link
Copy Markdown
Contributor

Looks like the spec introduced here is consistently failing on AppVeyor with the following error:

not ok 253 session module DownloadItem can generate a default filename
  AssertionError: 'download' == 'download.pdf'
      at EventEmitter.<anonymous> (C:\projects\electron\spec\api-session-spec.js:333:18)
      at EventEmitter.g (events.js:286:16)
      at emitMany (events.js:127:13)
      at EventEmitter.emit (events.js:201:7)

It doesn't appear to be failing though on our internal Windows build machines which is really strange.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default download savePath for URLs with a trailing slash

3 participants