fix: remove assets from shared link (#22935)

* fix remove assets from shared link

* rename var

* test: should remove individually shared asset

* test: should share individually assets

* fix failing tests
This commit is contained in:
Jorge Montejo
2025-10-16 21:03:41 +02:00
committed by GitHub
parent 2919ee4c65
commit a23dfff6cf
8 changed files with 98 additions and 3 deletions

View File

@@ -175,10 +175,12 @@ export class SharedLinkService extends BaseService {
throw new BadRequestException('Invalid shared link type');
}
const removedAssetIds = await this.sharedLinkAssetRepository.remove(id, dto.assetIds);
const results: AssetIdsResponseDto[] = [];
for (const assetId of dto.assetIds) {
const hasAsset = sharedLink.assets.find((asset) => asset.id === assetId);
if (!hasAsset) {
const wasRemoved = removedAssetIds.find((id) => id === assetId);
if (!wasRemoved) {
results.push({ assetId, success: false, error: AssetIdErrorReason.NOT_FOUND });
continue;
}