@@ -877,14 +877,15 @@ && checkPermissions(context, body.destinationWorkspaceId(), WorkspaceAction.writ
877877 // Copying between workspaces requires "readFile" on Workspace 1 and "writeFile" on Workspace 2
878878 if (!(checkPermissions (context , sourceWorkspace , WorkspaceAction .read_file_directory )
879879 && checkPermissions (context , body .destinationWorkspaceId (), WorkspaceAction .write_file_directory ))) {
880- final var copyResults = handleBulkCopy (
881- items ,
882- body .destinationPath (),
883- sourceWorkspace ,
884- body .destinationWorkspaceId (),
885- body .overwrite ());
886- context .status (207 ).json (copyResults .toString ());
880+ return ;
887881 }
882+ final var copyResults = handleBulkCopy (
883+ items ,
884+ body .destinationPath (),
885+ sourceWorkspace ,
886+ body .destinationWorkspaceId (),
887+ body .overwrite ());
888+ context .status (207 ).json (copyResults .toString ());
888889 }
889890 default -> context .status (501 ).json (new FormattedError ("Unsupported post action: " + body .action ().name ()).toJson ());
890891 }
@@ -899,9 +900,10 @@ private JsonArray handleBulkMove(
899900 ) throws NoSuchWorkspaceException {
900901 final var responseArray = Json .createArrayBuilder ();
901902 for (final var item : toMove ){
902- final var destinationPath = Path .of (destinationFolder .toString (), item );
903+ final var itemPath = Path .of (item );
904+ final var destinationPath = destinationFolder .resolve (itemPath .getFileName ());
903905 final var results = handleMove (
904- Path . of ( item ) ,
906+ itemPath ,
905907 destinationPath ,
906908 sourceWorkspaceId ,
907909 destinationWorkspaceId ,
@@ -924,9 +926,10 @@ private JsonArray handleBulkCopy(
924926 ) throws NoSuchWorkspaceException {
925927 final var responseArray = Json .createArrayBuilder ();
926928 for (final var item : toCopy ) {
927- final var destinationPath = Path .of (destinationFolder .toString (), item );
929+ final var itemPath = Path .of (item );
930+ final var destinationPath = destinationFolder .resolve (itemPath .getFileName ());
928931 final var results = handleCopy (
929- Path . of ( item ) ,
932+ itemPath ,
930933 destinationPath ,
931934 sourceWorkspaceId ,
932935 destinationWorkspaceId ,
0 commit comments