Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable10] Increment required only when encryption is enabled #28880

Merged
merged 1 commit into from
Sep 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions lib/private/Files/Storage/Wrapper/Encryption.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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]);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/features/trashbin-new-endpoint.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand 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"
Expand Down
20 changes: 18 additions & 2 deletions tests/integration/features/trashbin-old-endpoint.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand 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"
Expand 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"