Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add absolute download path #42

Open
msdobrescu opened this issue Jul 12, 2018 · 5 comments
Open

Add absolute download path #42

msdobrescu opened this issue Jul 12, 2018 · 5 comments

Comments

@msdobrescu
Copy link

It is difficult to set a relative download path.
Please add absolute download path support, if WE allows it.
Thank you.

@marklieberman
Copy link
Owner

marklieberman commented Jul 12, 2018

It is not possible to save files outside of the Downloads folder configured by Firefox. This is a deliberate decision by the Firefox developers.

https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/downloads/download

filename A string representing a file path relative to the default downloads directory — this provides the location where you want the file to be saved, and what filename you want to use. Absolute paths, empty paths, and paths containing back-references (../) will cause an error. If omitted, this value will default to the filename already given to the download file, and a location immediately inside the downloads directory.

@marklieberman
Copy link
Owner

marklieberman commented Jul 12, 2018

Related BugZilla bugs:
https://bugzilla.mozilla.org/show_bug.cgi?id=1342563

It may be possible to prompt once and then re-use the absolute folder if the bug gets patched. At priority P3 it could be months or years, unless someone decides to contribute a patch in the near future.

@msdobrescu
Copy link
Author

Interesting, why is it possible to download in any place with Firefox? I can save anywhere I please with Firefox's download manager.

@marklieberman
Copy link
Owner

@msdobrescu Simply because the native Firefox manager and downloads are using internal Firefox code. They are not written as web extensions and therefore have no restrictions in what they can do.

@buttercookie42
Copy link

I wonder whether something would be possible through native messaging, e.g. leveraging the native ext extension. That would allow packaging an additional script with the extension, which native-ext would then execute as a normal node.js script, so that additional script would have full user-level access to the file system.

Then, in the main extension you could detect if native-ext support is available, and if yes, unlock the ability to choose an arbitrary target path. Then,

  1. Download each file into a temporary directory underneath the default downloads directory permitted by Firefox.
  2. As each download in turn finishes, ask the native extension part to move that file to its intended final location.
  3. Once all downloads have finished, ask the native extension to delete that temporary directory again.

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

No branches or pull requests

3 participants