From 23b30736877c4b00622b2231284527b4fa20d85a Mon Sep 17 00:00:00 2001 From: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com> Date: Fri, 5 Jul 2024 15:08:14 +0200 Subject: [PATCH] fix(web): download archive for public user (#10877) --- e2e/src/web/specs/shared-link.e2e-spec.ts | 7 +++++++ web/src/lib/utils/asset-utils.ts | 5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/e2e/src/web/specs/shared-link.e2e-spec.ts b/e2e/src/web/specs/shared-link.e2e-spec.ts index 26dda709bd..e40c20388b 100644 --- a/e2e/src/web/specs/shared-link.e2e-spec.ts +++ b/e2e/src/web/specs/shared-link.e2e-spec.ts @@ -51,6 +51,13 @@ test.describe('Shared Links', () => { await page.getByText('DOWNLOADING', { exact: true }).waitFor(); }); + test('download all from shared link', async ({ page }) => { + await page.goto(`/share/${sharedLink.key}`); + await page.getByRole('heading', { name: 'Test Album' }).waitFor(); + await page.getByRole('button', { name: 'Download' }).click(); + await page.getByText('DOWNLOADING', { exact: true }).waitFor(); + }); + test('enter password for a shared link', async ({ page }) => { await page.goto(`/share/${sharedLinkPassword.key}`); await page.getByPlaceholder('Password').fill('test-password'); diff --git a/web/src/lib/utils/asset-utils.ts b/web/src/lib/utils/asset-utils.ts index 594fe09de7..6d8279a165 100644 --- a/web/src/lib/utils/asset-utils.ts +++ b/web/src/lib/utils/asset-utils.ts @@ -21,6 +21,7 @@ import { type AssetResponseDto, type AssetTypeEnum, type DownloadInfoDto, + type UserPreferencesResponseDto, type UserResponseDto, } from '@immich/sdk'; import { DateTime } from 'luxon'; @@ -100,8 +101,8 @@ export const downloadBlob = (data: Blob, filename: string) => { }; export const downloadArchive = async (fileName: string, options: Omit<DownloadInfoDto, 'archiveSize'>) => { - const $preferences = get(preferences); - const dto = { ...options, archiveSize: $preferences.download.archiveSize }; + const $preferences = get<UserPreferencesResponseDto | undefined>(preferences); + const dto = { ...options, archiveSize: $preferences?.download.archiveSize }; const [error, downloadInfo] = await withError(() => getDownloadInfo({ downloadInfoDto: dto, key: getKey() })); if (error) {