File tree Expand file tree Collapse file tree 1 file changed +6
-13
lines changed
lib/private/Files/Storage Expand file tree Collapse file tree 1 file changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -335,7 +335,7 @@ private function checkTreeForForbiddenItems(string $path) {
335335 }
336336 }
337337
338- public function rename ($ source , $ target ) {
338+ public function rename ($ source , $ target ): bool {
339339 $ srcParent = dirname ($ source );
340340 $ dstParent = dirname ($ target );
341341
@@ -361,21 +361,14 @@ public function rename($source, $target) {
361361 }
362362
363363 if ($ this ->is_dir ($ source )) {
364- // we can't move folders across devices, use copy instead
365- $ stat1 = stat (dirname ($ this ->getSourcePath ($ source )));
366- $ stat2 = stat (dirname ($ this ->getSourcePath ($ target )));
367- if ($ stat1 ['dev ' ] !== $ stat2 ['dev ' ]) {
368- $ result = $ this ->copy ($ source , $ target );
369- if ($ result ) {
370- $ result &= $ this ->rmdir ($ source );
371- }
372- return $ result ;
373- }
374-
375364 $ this ->checkTreeForForbiddenItems ($ this ->getSourcePath ($ source ));
376365 }
377366
378- return rename ($ this ->getSourcePath ($ source ), $ this ->getSourcePath ($ target ));
367+ if (@rename ($ this ->getSourcePath ($ source ), $ this ->getSourcePath ($ target ))) {
368+ return true ;
369+ }
370+
371+ return $ this ->copy ($ source , $ target ) && $ this ->rmdir ($ source );
379372 }
380373
381374 public function copy ($ source , $ target ) {
You can’t perform that action at this time.
0 commit comments