]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix copying folder across devices
authorRobin Appelman <icewind@owncloud.com>
Tue, 31 Mar 2015 11:47:06 +0000 (13:47 +0200)
committerRobin Appelman <icewind@owncloud.com>
Tue, 31 Mar 2015 11:50:11 +0000 (13:50 +0200)
lib/private/files/storage/local.php

index cf82e2189693e73a300f2b1822649513b6959df9..6bd9b4401d6efaafaba17e664367abf5e10a5598 100644 (file)
@@ -228,6 +228,19 @@ if (\OC_Util::runningOnWindows()) {
                                $this->unlink($path2);
                        }
 
+                       if ($this->is_dir($path1)) {
+                               // we cant move folders across devices, use copy instead
+                               $stat1 = stat(dirname($this->getSourcePath($path1)));
+                               $stat2 = stat(dirname($this->getSourcePath($path2)));
+                               if ($stat1['dev'] !== $stat2['dev']) {
+                                       $result = $this->copy($path1, $path2);
+                                       if ($result) {
+                                               $result &= $this->rmdir($path1);
+                                       }
+                                       return $result;
+                               }
+                       }
+
                        return rename($this->getSourcePath($path1), $this->getSourcePath($path2));
                }