Add a special case when downloading one file to name the tar after the file, not the enclosing directory.

This commit is contained in:
dfransway 2015-01-19 14:25:04 -08:00
parent 08cd031367
commit 4b1ca1970a

View file

@ -29,9 +29,17 @@ modulejs.define('ext/download', ['_', '$', 'core/settings', 'core/resource', 'co
var type = settings.type;
var extension = (type === 'shell-zip') ? 'zip' : 'tar';
var name;
if (selectedItems.length === 1) {
name = selectedItems[0].label;
} else {
name = settings.packageName || location.getItem().label;
}
var query = {
action: 'download',
as: (settings.packageName || location.getItem().label) + '.' + extension,
as: name + '.' + extension,
type: type,
hrefs: _.pluck(selectedItems, 'absHref').join('|:|')
};