From eb1e291e43c62d9792f7665b8ad870685d12a077 Mon Sep 17 00:00:00 2001 From: Alan Grainger <16197738+alangrainger@users.noreply.github.com> Date: Tue, 28 Oct 2025 17:09:08 +0800 Subject: [PATCH] #149 Add option to keep original filename when downloading --- app/src/render.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/render.ts b/app/src/render.ts index 2901396..f4fecdd 100644 --- a/app/src/render.ts +++ b/app/src/render.ts @@ -111,7 +111,9 @@ class Render { // You can specify this in your docker-compose file, or send it dynamically as a `publicBaseUrl` header const publicBaseUrl = process.env.PUBLIC_BASE_URL || res.req.headers.publicBaseUrl || (res.req.protocol + '://' + res.req.headers.host) - for (const asset of share.assets) { + const now = Date.now() + for (let i = 0; i < share.assets.length; i++) { + const asset = share.assets[i] let video, downloadUrl if (asset.type === AssetType.video) { // Populate the data-video property @@ -138,7 +140,7 @@ class Render { const description = getConfigOption('ipp.showMetadata.description', false) && typeof asset?.exifInfo?.description === 'string' ? asset.exifInfo.description.replace(/'/g, ''') : '' // Filename for the downloaded image - let filename = 'img_' + Date.now() + let filename = 'img_' + (now + i) if (getConfigOption('ipp.downloadedFilename') === 1) { filename = asset.originalFileName || filename } else if (getConfigOption('ipp.downloadedFilename') === 2) {