mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-25 12:34:47 -04:00
Add a special case when downloading one file to name the tar after the file, not the enclosing directory.
This commit is contained in:
parent
08cd031367
commit
4b1ca1970a
1 changed files with 9 additions and 1 deletions
|
@ -29,9 +29,17 @@ modulejs.define('ext/download', ['_', '$', 'core/settings', 'core/resource', 'co
|
||||||
|
|
||||||
var type = settings.type;
|
var type = settings.type;
|
||||||
var extension = (type === 'shell-zip') ? 'zip' : 'tar';
|
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 = {
|
var query = {
|
||||||
action: 'download',
|
action: 'download',
|
||||||
as: (settings.packageName || location.getItem().label) + '.' + extension,
|
as: name + '.' + extension,
|
||||||
type: type,
|
type: type,
|
||||||
hrefs: _.pluck(selectedItems, 'absHref').join('|:|')
|
hrefs: _.pluck(selectedItems, 'absHref').join('|:|')
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue