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 ;
@@ -731,6 +732,11 @@ public function deleteAll($directory) {
731732 public function rename ($ source , $ target ) {
732733 $ absolutePath1 = Filesystem::normalizePath ($ this ->getAbsolutePath ($ source ));
733734 $ absolutePath2 = Filesystem::normalizePath ($ this ->getAbsolutePath ($ target ));
735+
736+ if (str_starts_with ($ absolutePath2 , $ absolutePath1 . '/ ' )) {
737+ throw new ForbiddenException ("Moving a folder into a child folder is forbidden " , false );
738+ }
739+
734740 $ result = false ;
735741 if (
736742 Filesystem::isValidPath ($ target )
You can’t perform that action at this time.
0 commit comments