diff options
author | Robin Appelman <robin@icewind.nl> | 2022-11-30 15:11:27 +0100 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2022-12-01 14:36:27 +0100 |
commit | e3a0e646980b6f75b904e21bf127868aa8e2d66c (patch) | |
tree | 93f4b81061885ccb590998f0ceecaa4aee7e0ae4 | |
parent | e9b87c73faf4c2cdabca9e14762b7a5b67a57526 (diff) | |
download | nextcloud-server-e3a0e646980b6f75b904e21bf127868aa8e2d66c.tar.gz nextcloud-server-e3a0e646980b6f75b904e21bf127868aa8e2d66c.zip |
clear is-encrypted cache when trying to fix encrypted version
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r-- | apps/encryption/lib/Command/FixEncryptedVersion.php | 8 | ||||
-rw-r--r-- | lib/private/Files/Storage/Wrapper/Encryption.php | 4 |
2 files changed, 12 insertions, 0 deletions
diff --git a/apps/encryption/lib/Command/FixEncryptedVersion.php b/apps/encryption/lib/Command/FixEncryptedVersion.php index ab9cc528c54..bed56c3306f 100644 --- a/apps/encryption/lib/Command/FixEncryptedVersion.php +++ b/apps/encryption/lib/Command/FixEncryptedVersion.php @@ -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; @@ -165,6 +166,13 @@ class FixEncryptedVersion extends Command { */ 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) diff --git a/lib/private/Files/Storage/Wrapper/Encryption.php b/lib/private/Files/Storage/Wrapper/Encryption.php index eaecc0570d9..2f7123426d1 100644 --- a/lib/private/Files/Storage/Wrapper/Encryption.php +++ b/lib/private/Files/Storage/Wrapper/Encryption.php @@ -1095,4 +1095,8 @@ class Encryption extends Wrapper { return $count; } + + public function clearIsEncryptedCache(): void { + $this->encryptedPaths->clear(); + } } |