Merge pull request #9106 from paulo-graca/bugfix/issue-9099

Clear primary bistream when it's deleted- Fix issue #9099
This commit is contained in:
Alan Orth
2023-10-31 09:54:49 +03:00
committed by GitHub
5 changed files with 120 additions and 1 deletions

View File

@@ -276,6 +276,11 @@ public class BitstreamServiceImpl extends DSpaceObjectServiceImpl<Bitstream> imp
//Remove our bitstream from all our bundles
final List<Bundle> bundles = bitstream.getBundles();
for (Bundle bundle : bundles) {
authorizeService.authorizeAction(context, bundle, Constants.REMOVE);
//We also need to remove the bitstream id when it's set as bundle's primary bitstream
if (bitstream.equals(bundle.getPrimaryBitstream())) {
bundle.unsetPrimaryBitstreamID();
}
bundle.removeBitstream(bitstream);
}