Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
clear is-encrypted cache when trying to fix encrypted version
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 committed Dec 1, 2022
commit e3a0e646980b6f75b904e21bf127868aa8e2d66c
8 changes: 8 additions & 0 deletions apps/encryption/lib/Command/FixEncryptedVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

namespace OCA\Encryption\Command;

use OC\Files\Storage\Wrapper\Encryption;
use OC\Files\View;
use OC\ServerNotAvailableException;
use OCA\Encryption\Util;
Expand Down Expand Up @@ -165,6 +166,13 @@ private function walkPathOfUser(string $user, string $path, OutputInterface $out
*/
private function verifyFileContent(string $path, OutputInterface $output, bool $ignoreCorrectEncVersionCall = true): bool {
try {
// since we're manually poking around the encrypted state we need to ensure that this isn't cached in the encryption wrapper
$mount = $this->view->getMount($path);
$storage = $mount->getStorage();
if ($storage && $storage->instanceOfStorage(Encryption::class)) {
$storage->clearIsEncryptedCache();
}

/**
* In encryption, the files are read in a block size of 8192 bytes
* Read block size of 8192 and a bit more (808 bytes)
Expand Down
4 changes: 4 additions & 0 deletions lib/private/Files/Storage/Wrapper/Encryption.php
Original file line number Diff line number Diff line change
Expand Up @@ -1095,4 +1095,8 @@ public function writeStream(string $path, $stream, int $size = null): int {

return $count;
}

public function clearIsEncryptedCache(): void {
$this->encryptedPaths->clear();
}
}