From 4eca2b0f34ab5897ab060da5b831b85c651d4bd1 Mon Sep 17 00:00:00 2001 From: Mohamed BOUSSAID Date: Thu, 25 Jan 2024 18:14:02 +0100 Subject: [PATCH] feat(web): include timestamp in download filename (#5878) * Blocking multiple downloads * Blocking the download based on file name and not download type * Fixing failing workflow * Make sure the uniqueDownloadId is unique even if the selecting order is different * Using DateTime from luxon & convering the case of downloading an album * Fixing typo in the warning. * Covering the case where tha list of assets is to big * Fix format * Fix format * Fix format * Undo block multi-downloads * Running format:fix --------- Co-authored-by: Jason Rasmussen --- web/src/lib/components/shared-components/upload-panel.svelte | 2 +- web/src/lib/utils/asset-utils.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/web/src/lib/components/shared-components/upload-panel.svelte b/web/src/lib/components/shared-components/upload-panel.svelte index fd245a747d..6aa90b6a7f 100644 --- a/web/src/lib/components/shared-components/upload-panel.svelte +++ b/web/src/lib/components/shared-components/upload-panel.svelte @@ -44,7 +44,7 @@ if ($duplicateCounter > 0) { notificationController.show({ - message: `Skipped ${$duplicateCounter} duplicate picture${$duplicateCounter > 1 ? 's' : ''}`, + message: `Skipped ${$duplicateCounter} duplicate asset${$duplicateCounter > 1 ? 's' : ''}`, type: NotificationType.Warning, }); } diff --git a/web/src/lib/utils/asset-utils.ts b/web/src/lib/utils/asset-utils.ts index 9a5c398f4c..a060e1a7f8 100644 --- a/web/src/lib/utils/asset-utils.ts +++ b/web/src/lib/utils/asset-utils.ts @@ -10,6 +10,7 @@ import { type UserResponseDto, } from '@api'; import { handleError } from './handle-error'; +import { DateTime } from 'luxon'; export const addAssetsToAlbum = async (albumId: string, assetIds: Array): Promise => api.albumApi @@ -59,7 +60,7 @@ export const downloadArchive = async (fileName: string, options: DownloadInfoDto for (let i = 0; i < downloadInfo.archives.length; i++) { const archive = downloadInfo.archives[i]; const suffix = downloadInfo.archives.length === 1 ? '' : `+${i + 1}`; - const archiveName = fileName.replace('.zip', `${suffix}.zip`); + const archiveName = fileName.replace('.zip', `${suffix}-${DateTime.now().toFormat('yyyy-LL-dd-HH-mm-ss')}.zip`); let downloadKey = `${archiveName} `; if (downloadInfo.archives.length > 1) {