Commit b9fb7a45 authored by Nicola Fulvio Calabria's avatar Nicola Fulvio Calabria
Browse files

Updated constraints to copy paths

parent 0babd77f
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -47,6 +47,11 @@ public class CopyService extends AbstractNodeService {
        if (destinationPath.startsWith(sourcePath + "/")) {
            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 {

+5 −0
Original line number Diff line number Diff line
@@ -50,6 +50,11 @@ public class MoveService extends AbstractNodeService {
        // Linux-like: "cannot move to a subdirectory of itself" 
        if(destinationPath.startsWith(sourcePath+"/")) {
            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 {