Adds check for whether source and target collections are the same when moving an item. (#8055)

This commit is contained in:
Huma Zafar
2022-02-12 14:49:27 -05:00
committed by Huma Zafar
parent baea61e1b6
commit 8c44a95c7b
2 changed files with 30 additions and 0 deletions

View File

@@ -911,6 +911,12 @@ public class ItemServiceImpl extends DSpaceObjectServiceImpl<Item> implements It
@Override
public void move(Context context, Item item, Collection from, Collection to)
throws SQLException, AuthorizeException, IOException {
// If the two collections are the same, do nothing.
if (from.equals(to)) {
return;
}
// Use the normal move method, and default to not inherit permissions
this.move(context, item, from, to, false);
}