clear is-encrypted cache when trying to fix encrypted version

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2022-11-30 15:11:27 +01:00
parent e9b87c73fa
commit e3a0e64698
No known key found for this signature in database
GPG key ID: 42B69D8A64526EFB
2 changed files with 12 additions and 0 deletions

View file

@ -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)

View file

@ -1095,4 +1095,8 @@ class Encryption extends Wrapper {
return $count;
}
public function clearIsEncryptedCache(): void {
$this->encryptedPaths->clear();
}
}