Skip to content

Commit 7892b65

Browse files
committed
YDA-6078: don't add empty collections as files to download zip
1 parent c0201e6 commit 7892b65

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

deposit/static/deposit/js/dlgFileBrowseOperations.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,12 @@ $(document).ready(function () {
110110
for (const item of data) {
111111
const filepath = `${path}/${item.name}`
112112
const url = `/deposit/browse/download?filepath=${encodeURIComponent(filepath)}`
113-
downloadEntries.push({ url, name: name + '/' + item.name })
113+
114+
if (!item.name.endsWith('/')) {
115+
downloadEntries.push({ url, name: name + '/' + item.name })
116+
} else {
117+
downloadEntries.push({ name: name + '/' + item.name })
118+
}
114119
}
115120
} else {
116121
// Single file: add directly

research/static/research/js/dlgFileBrowseOperations.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,12 @@ $(document).ready(function () {
106106
for (const item of data) {
107107
const filepath = `${path}/${item.name}`
108108
const url = `/research/browse/download?filepath=${encodeURIComponent(filepath)}`
109-
downloadEntries.push({ url, name: name + '/' + item.name })
109+
110+
if (!item.name.endsWith('/')) {
111+
downloadEntries.push({ url, name: name + '/' + item.name })
112+
} else {
113+
downloadEntries.push({ name: name + '/' + item.name })
114+
}
110115
}
111116
} else {
112117
// Single file: add directly

vault/static/vault/js/dlgSelectCollection.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,12 @@ $('body').on('click', 'a.multiple-download', async function (event) {
365365
for (const item of data) {
366366
const filepath = `${path}/${item.name}`
367367
const url = `/vault/browse/download?filepath=${encodeURIComponent(filepath)}`
368-
downloadEntries.push({ url, name: name + '/' + item.name })
368+
369+
if (!item.name.endsWith('/')) {
370+
downloadEntries.push({ url, name: name + '/' + item.name })
371+
} else {
372+
downloadEntries.push({ name: name + '/' + item.name })
373+
}
369374
}
370375
} else {
371376
// Single file: add directly

0 commit comments

Comments
 (0)