diff options
author | Morris Jobke <hey@morrisjobke.de> | 2015-05-20 14:44:01 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-05-20 14:44:01 +0200 |
commit | 39d1e99228a22e232795b9800503697b866f5023 (patch) | |
tree | 01e67900bdec53eec9a6cc2ac201a35accd015da /lib | |
parent | 1a67e5cdc3242433225b6b8c08b7664f47c78255 (diff) | |
parent | 2213d6597c5d052acc27e294227a10d23ba00448 (diff) | |
download | nextcloud-server-39d1e99228a22e232795b9800503697b866f5023.tar.gz nextcloud-server-39d1e99228a22e232795b9800503697b866f5023.zip |
Merge pull request #16322 from owncloud/trash-view
dont go trough the view when moving to trash
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/files/storage/common.php | 15 | ||||
-rw-r--r-- | lib/private/files/storage/wrapper/wrapper.php | 8 |
2 files changed, 20 insertions, 3 deletions
diff --git a/lib/private/files/storage/common.php b/lib/private/files/storage/common.php index fc30b385e2e..893e4ea7d9b 100644 --- a/lib/private/files/storage/common.php +++ b/lib/private/files/storage/common.php @@ -498,18 +498,18 @@ abstract class Common implements Storage { * @throws InvalidPathException */ private function scanForInvalidCharacters($fileName, $invalidChars) { - foreach(str_split($invalidChars) as $char) { + foreach (str_split($invalidChars) as $char) { if (strpos($fileName, $char) !== false) { throw new InvalidCharacterInPathException(); } } $sanitizedFileName = filter_var($fileName, FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_LOW); - if($sanitizedFileName !== $fileName) { + if ($sanitizedFileName !== $fileName) { throw new InvalidCharacterInPathException(); } } - + /** * @param array $options */ @@ -525,6 +525,7 @@ abstract class Common implements Storage { public function getMountOption($name, $default = null) { return isset($this->mountOptions[$name]) ? $this->mountOptions[$name] : $default; } + /** * @param \OCP\Files\Storage $sourceStorage * @param string $sourceInternalPath @@ -533,6 +534,10 @@ abstract class Common implements Storage { * @return bool */ public function copyFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = false) { + if ($sourceStorage === $this) { + return $this->copy($sourceInternalPath, $targetInternalPath); + } + if ($sourceStorage->is_dir($sourceInternalPath)) { $dh = $sourceStorage->opendir($sourceInternalPath); $result = $this->mkdir($targetInternalPath); @@ -575,6 +580,10 @@ abstract class Common implements Storage { * @return bool */ public function moveFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) { + if ($sourceStorage === $this) { + return $this->rename($sourceInternalPath, $targetInternalPath); + } + $result = $this->copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath, true); if ($result) { if ($sourceStorage->is_dir($sourceInternalPath)) { diff --git a/lib/private/files/storage/wrapper/wrapper.php b/lib/private/files/storage/wrapper/wrapper.php index f3dc09db138..14024addec4 100644 --- a/lib/private/files/storage/wrapper/wrapper.php +++ b/lib/private/files/storage/wrapper/wrapper.php @@ -513,6 +513,10 @@ class Wrapper implements \OC\Files\Storage\Storage { * @return bool */ public function copyFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) { + if ($sourceStorage === $this) { + return $this->copy($sourceInternalPath, $targetInternalPath); + } + return $this->storage->copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath); } @@ -523,6 +527,10 @@ class Wrapper implements \OC\Files\Storage\Storage { * @return bool */ public function moveFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) { + if ($sourceStorage === $this) { + return $this->rename($sourceInternalPath, $targetInternalPath); + } + return $this->storage->moveFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath); } |