diff --git a/lib/private/Files/Storage/Wrapper/Encryption.php b/lib/private/Files/Storage/Wrapper/Encryption.php index e1b5049d1fda..eb5187d241e8 100644 --- a/lib/private/Files/Storage/Wrapper/Encryption.php +++ b/lib/private/Files/Storage/Wrapper/Encryption.php @@ -385,7 +385,7 @@ public function fopen($path, $mode) { $header = $this->getHeader($path); $signed = (isset($header['signed']) && $header['signed'] === 'true') ? true : false; $fullPath = $this->getFullPath($path); - $encryptionModuleId = ($encryptionEnabled) ? $this->util->getEncryptionModuleId($header): ""; + $encryptionModuleId = $this->util->getEncryptionModuleId($header); if ($this->util->isExcluded($fullPath) === false) { @@ -712,7 +712,9 @@ private function updateEncryptedVersion(Storage $sourceStorage, $sourceInternalP * incremented version of source file, for the destination file. */ $encryptedVersion = $sourceStorage->getCache()->get($sourceInternalPath)['encryptedVersion']; - $cacheInformation['encryptedVersion'] = $encryptedVersion + 1; + if ($this->encryptionManager->isEnabled()) { + $cacheInformation['encryptedVersion'] = $encryptedVersion + 1; + } $sourceStorage->getCache()->put($sourceInternalPath, $cacheInformation); } else { $this->getCache()->put($targetInternalPath, $cacheInformation); @@ -781,8 +783,7 @@ private function copyBetweenStorage(Storage $sourceStorage, $sourceInternalPath, try { $source = $sourceStorage->fopen($sourceInternalPath, 'r'); if ($isRename) { - $absSourcePath = Filesystem::normalizePath($sourceStorage->getOwner($sourceInternalPath). '/' . $sourceInternalPath); - $this->sourcePath[$targetInternalPath] = $absSourcePath; + $this->sourcePath[$targetInternalPath] = $sourceStorage->getFullPath($sourceInternalPath); } else { unset($this->sourcePath[$targetInternalPath]); } diff --git a/tests/integration/features/trashbin-new-endpoint.feature b/tests/integration/features/trashbin-new-endpoint.feature index 858412b0622a..1716d8332239 100644 --- a/tests/integration/features/trashbin-new-endpoint.feature +++ b/tests/integration/features/trashbin-new-endpoint.feature @@ -121,7 +121,7 @@ Feature: trashbin-new-endpoint And as "user0" the folder with original path "/textfile0.txt" exists in trash @local_storage - @no_encryption + @no_default_encryption Scenario: Deleting a folder into external storage moves it to the trashbin Given As an "admin" And invoking occ with "files:scan --all" @@ -132,7 +132,7 @@ Feature: trashbin-new-endpoint Then as "user0" the folder with original path "/local_storage/tmp" exists in trash @local_storage - @no_encryption + @no_default_encryption Scenario: Deleting a file into external storage moves it to the trashbin and can be restored Given As an "admin" And invoking occ with "files:scan --all" diff --git a/tests/integration/features/trashbin-old-endpoint.feature b/tests/integration/features/trashbin-old-endpoint.feature index 2a68271b293f..1154c4f1f867 100644 --- a/tests/integration/features/trashbin-old-endpoint.feature +++ b/tests/integration/features/trashbin-old-endpoint.feature @@ -121,7 +121,7 @@ Feature: trashbin-new-endpoint And as "user0" the folder with original path "/textfile0.txt" exists in trash @local_storage - @no_encryption + @no_default_encryption Scenario: Deleting a folder into external storage moves it to the trashbin Given As an "admin" And invoking occ with "files:scan --all" @@ -132,7 +132,7 @@ Feature: trashbin-new-endpoint Then as "user0" the folder with original path "/local_storage/tmp" exists in trash @local_storage - @no_encryption + @no_default_encryption Scenario: Deleting a file into external storage moves it to the trashbin and can be restored Given As an "admin" And invoking occ with "files:scan --all" @@ -148,3 +148,19 @@ Feature: trashbin-new-endpoint | /local_storage/ | | /local_storage/tmp/ | | /local_storage/tmp/textfile0.txt | + + @local_storage + @no_default_encryption + Scenario: Deleting an updated file into external storage moves it to the trashbin and can be restored + Given As an "admin" + And invoking occ with "files:scan --all" + And user "user0" exists + And user "user0" created a folder "/local_storage/tmp" + And User "user0" moved file "/textfile0.txt" to "/local_storage/tmp/textfile0.txt" + And user "user0" uploads chunk file "1" of "1" with "AA" to "/local_storage/tmp/textfile0.txt" + And User "user0" deletes file "/local_storage/tmp/textfile0.txt" + And as "user0" the folder with original path "/local_storage/tmp/textfile0.txt" exists in trash + And Logging in using web as "user0" + When as "user0" the folder with original path "/local_storage/tmp/textfile0.txt" is restored + Then as "user0" the folder with original path "/local_storage/tmp/textfile0.txt" does not exist in trash + And Downloaded content when downloading file "/local_storage/tmp/textfile0.txt" with range "bytes=0-1" should be "AA"