diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2020-08-31 12:25:20 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2020-08-31 12:25:20 +0200 |
commit | 6ffd7173f909788dd1808e493b94ec390a785604 (patch) | |
tree | 06e967455d7033af3d20641e4af502629a45adef /lib/private/Files | |
parent | c43189beaed0e6be06026b4aec9a1063257a5d65 (diff) | |
download | nextcloud-server-6ffd7173f909788dd1808e493b94ec390a785604.tar.gz nextcloud-server-6ffd7173f909788dd1808e493b94ec390a785604.zip |
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/private/Files')
-rw-r--r-- | lib/private/Files/ObjectStore/ObjectStoreStorage.php | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php index a5112bcbba6..b2ec094a71e 100644 --- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php +++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php @@ -465,11 +465,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 } |