Fix #221 - single selection should not be a zip

This commit is contained in:
Alan Grainger
2026-05-25 16:23:24 +08:00
parent 349cf0061b
commit cd12f792a7
+15
View File
@@ -441,6 +441,21 @@ function selectAllOrNone () {
function downloadSelected () { function downloadSelected () {
if (selected.size === 0) return if (selected.size === 0) return
// Single selection: download the file directly so the user gets the image
// (or video) instead of a one-entry zip.
if (selected.size === 1) {
const id = selected.values().next().value
const item = items.find(it => it.id === id)
if (item && item.downloadUrl) {
const a = document.createElement('a')
a.href = item.downloadUrl
a.download = item.downloadFilename || ''
document.body.appendChild(a)
a.click()
a.remove()
return
}
}
// Form POST so the browser handles streaming the zip directly to disk. // Form POST so the browser handles streaming the zip directly to disk.
const form = document.createElement('form') const form = document.createElement('form')
form.method = 'POST' form.method = 'POST'