diff --git a/server/apps/immich/src/api-v1/album/response-dto/album-response.dto.ts b/server/apps/immich/src/api-v1/album/response-dto/album-response.dto.ts index dde9998e3e..71d4475430 100644 --- a/server/apps/immich/src/api-v1/album/response-dto/album-response.dto.ts +++ b/server/apps/immich/src/api-v1/album/response-dto/album-response.dto.ts @@ -18,7 +18,14 @@ export class AlbumResponseDto { } export function mapAlbum(entity: AlbumEntity): AlbumResponseDto { - const sharedUsers = entity.sharedUsers?.map((userAlbum) => mapUser(userAlbum.userInfo)) || []; + const sharedUsers: UserResponseDto[] = []; + + entity.sharedUsers?.forEach((userAlbum) => { + if (userAlbum.userInfo) { + const user = mapUser(userAlbum.userInfo); + sharedUsers.push(user); + } + }); return { albumName: entity.albumName, albumThumbnailAssetId: entity.albumThumbnailAssetId, @@ -33,7 +40,14 @@ export function mapAlbum(entity: AlbumEntity): AlbumResponseDto { } export function mapAlbumExcludeAssetInfo(entity: AlbumEntity): AlbumResponseDto { - const sharedUsers = entity.sharedUsers?.map((userAlbum) => mapUser(userAlbum.userInfo)) || []; + const sharedUsers: UserResponseDto[] = []; + + entity.sharedUsers?.forEach((userAlbum) => { + if (userAlbum.userInfo) { + const user = mapUser(userAlbum.userInfo); + sharedUsers.push(user); + } + }); return { albumName: entity.albumName, albumThumbnailAssetId: entity.albumThumbnailAssetId,