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

[Feature Request] Default file extension option #71

Open
yfdyh000 opened this issue Aug 25, 2018 · 4 comments
Open

[Feature Request] Default file extension option #71

yfdyh000 opened this issue Aug 25, 2018 · 4 comments

Comments

@yfdyh000
Copy link

I prefer to keep the original extension of the file.
Expected option: zip or leave blank by default, leave blank = original extension. Allow users to set to like crx, xpi, etc. (unlimited)

@yfdyh000
Copy link
Author

Also I have a question, click the "View source" button of popup adds the &zipname=, use the "View extension source" context menu don't adds the the parameter, but both downloads get the same zip extension.

@yfdyh000
Copy link
Author

In addition, there is a glitch, no index: tab.index + 1 in contextMenusOnClicked.

@Rob--W
Copy link
Owner

Rob--W commented Aug 25, 2018

xpi files are zips, CRX files are not really zips (but I convert them to a zip file by stripping the CRX-specific header). I use a "zip" extension because it is the most accurate file extension for the download, with the best usability when one is interested in viewing the source of the extension (opposed to installing it).

Why do you want to have the ability to accept different extensions? What is the use case?

The filename (zipname or constructed from the URL) is always converted to a zip extension::

zipname = get_zip_name(crx_url, zipname);

// Return the suggested name of the zip file.
function get_zip_name(url, /*optional*/filename) {
if (!filename) {
var extensionID = get_extensionID(url);
if (extensionID) {
filename = extensionID;
} else {
// https://addons.opera.com/en/extensions/details/<slug>/?display=en
// AMO: Lots of different formats, but usually ending with .xpi?....
url = url.split(/[?#]/, 1)[0];
filename = /([^\/]+?)\/*$/.exec(url)[1];
}
}
return filename.replace(/\.(crx|jar|nex|xpi|zip)$/i, '') + '.zip';
}

In addition, there is a glitch, no index: tab.index + 1 in contextMenusOnClicke.

That's easy to fix. Do you want to submit a pull request?
Bonus: In Firefox, you can set the browser.tabs.insertAfterCurrent preference to true to automatically open the tab after the current tab. This preference is also available through an extension API ( https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/browserSettings/newTabPosition ) and used by e.g. the Always Right add-on ( https://addons.mozilla.org/en-US/firefox/addon/always-right/ ).

@Rob--W
Copy link
Owner

Rob--W commented Oct 21, 2018

In addition, there is a glitch, no index: tab.index + 1 in contextMenusOnClicked.

This part is fixed in 1a007bd

If you still want the originally requested feature, please answer the question about the use case from my previous comment.

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

No branches or pull requests

2 participants