Skip to content

Commit 41766ea

Browse files
mPyKensavely-krasovsky
authored andcommitted
fix(server): Exclude album assets in shared link payload (immich-app#17207)
* fix(server): Exclude album assets in shared link payload * Fix e2e test
1 parent 6e17a58 commit 41766ea

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

e2e/src/api/specs/shared-link.e2e-spec.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -246,15 +246,7 @@ describe('/shared-links', () => {
246246
const { status, body } = await request(app).get('/shared-links/me').query({ key: linkWithMetadata.key });
247247

248248
expect(status).toBe(200);
249-
expect(body.assets).toHaveLength(1);
250-
expect(body.assets[0]).toEqual(
251-
expect.objectContaining({
252-
originalFileName: 'example.png',
253-
localDateTime: expect.any(String),
254-
fileCreatedAt: expect.any(String),
255-
exifInfo: expect.any(Object),
256-
}),
257-
);
249+
expect(body.assets).toHaveLength(0);
258250
expect(body.album).toBeDefined();
259251
});
260252

server/src/dtos/shared-link.dto.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,6 @@ export class SharedLinkResponseDto {
104104

105105
export function mapSharedLink(sharedLink: SharedLinkEntity): SharedLinkResponseDto {
106106
const linkAssets = sharedLink.assets || [];
107-
const albumAssets = (sharedLink?.album?.assets || []).map((asset) => asset);
108-
109-
const assets = _.uniqBy([...linkAssets, ...albumAssets], (asset) => asset.id);
110107

111108
return {
112109
id: sharedLink.id,
@@ -117,7 +114,7 @@ export function mapSharedLink(sharedLink: SharedLinkEntity): SharedLinkResponseD
117114
type: sharedLink.type,
118115
createdAt: sharedLink.createdAt,
119116
expiresAt: sharedLink.expiresAt,
120-
assets: assets.map((asset) => mapAsset(asset)),
117+
assets: linkAssets.map((asset) => mapAsset(asset)),
121118
album: sharedLink.album ? mapAlbumWithoutAssets(sharedLink.album) : undefined,
122119
allowUpload: sharedLink.allowUpload,
123120
allowDownload: sharedLink.allowDownload,

0 commit comments

Comments
 (0)