mirror of
https://github.com/immich-app/immich.git
synced 2025-05-24 01:12:58 -04:00
fix(server): Exclude album assets in shared link payload (#17207)
* fix(server): Exclude album assets in shared link payload * Fix e2e test
This commit is contained in:
parent
8203b6c450
commit
8242ff9bab
@ -246,15 +246,7 @@ describe('/shared-links', () => {
|
|||||||
const { status, body } = await request(app).get('/shared-links/me').query({ key: linkWithMetadata.key });
|
const { status, body } = await request(app).get('/shared-links/me').query({ key: linkWithMetadata.key });
|
||||||
|
|
||||||
expect(status).toBe(200);
|
expect(status).toBe(200);
|
||||||
expect(body.assets).toHaveLength(1);
|
expect(body.assets).toHaveLength(0);
|
||||||
expect(body.assets[0]).toEqual(
|
|
||||||
expect.objectContaining({
|
|
||||||
originalFileName: 'example.png',
|
|
||||||
localDateTime: expect.any(String),
|
|
||||||
fileCreatedAt: expect.any(String),
|
|
||||||
exifInfo: expect.any(Object),
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
expect(body.album).toBeDefined();
|
expect(body.album).toBeDefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -104,9 +104,6 @@ export class SharedLinkResponseDto {
|
|||||||
|
|
||||||
export function mapSharedLink(sharedLink: SharedLinkEntity): SharedLinkResponseDto {
|
export function mapSharedLink(sharedLink: SharedLinkEntity): SharedLinkResponseDto {
|
||||||
const linkAssets = sharedLink.assets || [];
|
const linkAssets = sharedLink.assets || [];
|
||||||
const albumAssets = (sharedLink?.album?.assets || []).map((asset) => asset);
|
|
||||||
|
|
||||||
const assets = _.uniqBy([...linkAssets, ...albumAssets], (asset) => asset.id);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: sharedLink.id,
|
id: sharedLink.id,
|
||||||
@ -117,7 +114,7 @@ export function mapSharedLink(sharedLink: SharedLinkEntity): SharedLinkResponseD
|
|||||||
type: sharedLink.type,
|
type: sharedLink.type,
|
||||||
createdAt: sharedLink.createdAt,
|
createdAt: sharedLink.createdAt,
|
||||||
expiresAt: sharedLink.expiresAt,
|
expiresAt: sharedLink.expiresAt,
|
||||||
assets: assets.map((asset) => mapAsset(asset)),
|
assets: linkAssets.map((asset) => mapAsset(asset)),
|
||||||
album: sharedLink.album ? mapAlbumWithoutAssets(sharedLink.album) : undefined,
|
album: sharedLink.album ? mapAlbumWithoutAssets(sharedLink.album) : undefined,
|
||||||
allowUpload: sharedLink.allowUpload,
|
allowUpload: sharedLink.allowUpload,
|
||||||
allowDownload: sharedLink.allowDownload,
|
allowDownload: sharedLink.allowDownload,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user