mirror of
https://github.com/nextcloud/server.git
synced 2026-06-12 02:00:51 -04:00
Don't lose filecache entry on s3 overwrite error
If the object store errors we should not always delete the filecache entry. As this might lead to people losing access to their files. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
parent
db36ad575a
commit
f909d2a39a
1 changed files with 16 additions and 5 deletions
|
|
@ -463,11 +463,22 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
|
|||
$this->objectStore->writeObject($urn, $stream);
|
||||
}
|
||||
} catch (\Exception $ex) {
|
||||
$this->getCache()->remove($uploadPath);
|
||||
$this->logger->logException($ex, [
|
||||
'app' => 'objectstore',
|
||||
'message' => 'Could not create object ' . $urn . ' for ' . $path,
|
||||
]);
|
||||
if (!$exists) {
|
||||
/*
|
||||
* Only remove the entry if we are dealing with a new file.
|
||||
* Else people lose access to existing files
|
||||
*/
|
||||
$this->getCache()->remove($uploadPath);
|
||||
$this->logger->logException($ex, [
|
||||
'app' => 'objectstore',
|
||||
'message' => 'Could not create object ' . $urn . ' for ' . $path,
|
||||
]);
|
||||
} else {
|
||||
$this->logger->logException($ex, [
|
||||
'app' => 'objectstore',
|
||||
'message' => 'Could not update object ' . $urn . ' for ' . $path,
|
||||
]);
|
||||
}
|
||||
throw $ex; // make this bubble up
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue