File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change 5959use OCP \Files \ConnectionLostException ;
6060use OCP \Files \EmptyFileNameException ;
6161use OCP \Files \FileNameTooLongException ;
62+ use OCP \Files \ForbiddenException ;
6263use OCP \Files \InvalidCharacterInPathException ;
6364use OCP \Files \InvalidDirectoryException ;
6465use OCP \Files \InvalidPathException ;
@@ -733,6 +734,11 @@ public function deleteAll($directory) {
733734 public function rename ($ source , $ target ) {
734735 $ absolutePath1 = Filesystem::normalizePath ($ this ->getAbsolutePath ($ source ));
735736 $ absolutePath2 = Filesystem::normalizePath ($ this ->getAbsolutePath ($ target ));
737+
738+ if (str_starts_with ($ absolutePath2 . '/ ' , $ absolutePath1 )) {
739+ throw new ForbiddenException ("Moving a folder into a child folder is forbidden " , false );
740+ }
741+
736742 $ targetParts = explode ('/ ' , $ absolutePath2 );
737743 $ targetUser = $ targetParts [1 ] ?? null ;
738744 $ result = false ;
You can’t perform that action at this time.
0 commit comments