fix(server): deleting stacked assets (#25874)

* fix(server): deleting stacked assets

* fix: log a warning when removing an empty directory fails
This commit is contained in:
Jason Rasmussen
2026-02-04 12:33:37 -05:00
committed by GitHub
parent 9dddccd831
commit 6cdebdd3b3
6 changed files with 127 additions and 80 deletions

View File

@@ -327,10 +327,11 @@ export class AssetService extends BaseService {
return JobStatus.Failed;
}
// Replace the parent of the stack children with a new asset
// replace the parent of the stack children with a new asset
if (asset.stack?.primaryAssetId === id) {
const stackAssetIds = asset.stack?.assets.map((a) => a.id) ?? [];
if (stackAssetIds.length > 2) {
// this only includes timeline visible assets and excludes the primary asset
const stackAssetIds = asset.stack.assets.map((a) => a.id);
if (stackAssetIds.length >= 2) {
const newPrimaryAssetId = stackAssetIds.find((a) => a !== id)!;
await this.stackRepository.update(asset.stack.id, {
id: asset.stack.id,