Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2020-08-31 13:25:20 +0300
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2020-08-31 20:08:34 +0300
commitf909d2a39ad8c400a1e8bdef34dc3fd8b2ec6bd9 (patch)
treeb7ae89dc337c86b7c2ba98429d6e1ce73a73a8c3 /lib
parentdb36ad575a205d2fccad168cab752db6280c0c0b (diff)
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>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Files/ObjectStore/ObjectStoreStorage.php21
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php
index e0d437839a0..1658c913910 100644
--- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php
+++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php
@@ -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
}