Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

With Ask where to save, Save As dialog starts in default folder not lastDir #5390

Open
jscher2000 opened this issue Aug 12, 2019 · 0 comments

Comments

@jscher2000
Copy link

The Download button triggers a Save As file browser dialog instead of displaying the Download (Open/Save/Cancel) dialog. By contrast, the Save Screenshot extension integrates with the Download dialog by default. That latter behavior has the benefit of leveraging browser.download.lastDir which is very convenient (it's faster to click OK a few times than to navigate the Save As dialog to a different folder over and over).

I have tried very hard to figure out why the calls to browser.downloads.download() have such different results but I just can't see a problem in the code. Could it be related to using an iframe?

https://github.com/mozilla-services/screenshots/blob/master/webextension/background/main.js#L268

return browser.windows.getLastFocused().then(windowInfo => {
  return browser.downloads.download({
    url,
    incognito: windowInfo.incognito,
    filename: info.filename,
  }).catch((error) => {
    // We are not logging error message when user cancels download
    if (error && error.message && !error.message.includes("canceled")) {
      log.error(error.message);
    }
  }).then((id) => {
    downloadId = id;
  });

https://github.com/M-Reimer/savescreenshot/blob/master/background.js#L86

  const method = prefs.savemethod || "open";
  browser.downloads.download({
    filename: aMessage.filename,
    url: bloburi,
    saveAs: (method == "saveas") ? true : false
  });
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant