- const diffPathToRemove = _.difference(paths, pathsToRemove);
- await services.collectionService.deleteFiles(selectedCollection.uuid, pathsToRemove);
- const collectionWithDeletedFiles = await services.collectionService.get(collectionUuid);
- await services.collectionService.update(collectionUuid, { manifestText: `${collectionWithDeletedFiles.manifestText}${currentCollection.manifestText ? currentCollection.manifestText : currentCollection.unsignedManifestText}` });
- await services.collectionService.deleteFiles(collectionWithDeletedFiles.uuid, diffPathToRemove);
+ const diffPathToRemove = difference(paths, pathsToRemove);
+ await services.collectionService.deleteFiles(selectedCollection.uuid, pathsToRemove.map(path => path.replace(currentCollection.uuid, collectionUuid)));
+ const collectionWithDeletedFiles = await services.collectionService.get(collectionUuid, undefined, ['uuid', 'manifestText']);
+ await services.collectionService.update(collectionUuid, { manifestText: `${collectionWithDeletedFiles.manifestText}${(currentCollection.manifestText ? currentCollection.manifestText : currentCollection.unsignedManifestText) || ''}` });
+ await services.collectionService.deleteFiles(collectionWithDeletedFiles.uuid, diffPathToRemove.map(path => path.replace(currentCollection.uuid, collectionUuid)));