From cd12f792a78545128714fb7782df5780ff407924 Mon Sep 17 00:00:00 2001 From: Alan Grainger <16197738+alangrainger@users.noreply.github.com> Date: Mon, 25 May 2026 16:23:24 +0800 Subject: [PATCH] Fix #221 - single selection should not be a zip --- app/public/web.js | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/app/public/web.js b/app/public/web.js index cda57f6..ba3b2e5 100644 --- a/app/public/web.js +++ b/app/public/web.js @@ -441,6 +441,21 @@ function selectAllOrNone () { function downloadSelected () { 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. const form = document.createElement('form') form.method = 'POST' @@ -574,7 +589,7 @@ function loadVisibleTiles () { const aTopInVp = containerTop + parseFloat(a.style.top || '0') const aHeight = parseFloat(a.style.height || '0') const isFar = aTopInVp + aHeight < -IMAGE_LOAD_MARGIN_PX || - aTopInVp > vpHeight + IMAGE_LOAD_MARGIN_PX + aTopInVp > vpHeight + IMAGE_LOAD_MARGIN_PX if (isFar) { if (img.src && !img.complete) { img.dataset.src = img.src @@ -629,9 +644,9 @@ function buildDataSource () { return { html: '