Skip to content
Snippets Groups Projects
Commit b9fb7a45 authored by Nicola Fulvio Calabria's avatar Nicola Fulvio Calabria
Browse files

Updated constraints to copy paths

parent 0babd77f
Branches
No related tags found
No related merge requests found
......@@ -48,6 +48,11 @@ public class CopyService extends AbstractNodeService {
throw new IllegalArgumentException("Cannot copy node to a subdirectory of its own path");
}
// Check if destination equals parent path of source
if(NodeUtils.getParentPath(sourcePath).equals(destinationPath)){
throw new IllegalArgumentException("Cannot duplicate node at same path without renaming it");
}
try {
// check source branch for read and lock it
......
......@@ -52,6 +52,11 @@ public class MoveService extends AbstractNodeService {
throw new IllegalArgumentException("Cannot move node to a subdirectory of its own path");
}
// Check if destination equals parent path of source
if(NodeUtils.getParentPath(sourcePath).equals(destinationPath)){
return;
}
try {
// Get source node
Optional<Long> sourceIdOpt = nodeDao.getNodeId(sourcePath);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment