summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2019-04-08 13:21:46 +0200
committerBackportbot <backportbot-noreply@rullzer.com>2019-04-08 14:36:37 +0000
commitdc99cc7eab5bcf767a45bda6a1cdec7374c09423 (patch)
tree063db75f83c8dbb6360b7b932660899912e03e22 /lib/private
parent3fc462e33207e0bec720507a0875686d45bec1fc (diff)
downloadnextcloud-server-dc99cc7eab5bcf767a45bda6a1cdec7374c09423.tar.gz
nextcloud-server-dc99cc7eab5bcf767a45bda6a1cdec7374c09423.zip
Harden appdata putcontent
If for whatever reason appdata got into a strange state this will at least propegate up and not make it do boom the next run. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/Files/SimpleFS/SimpleFile.php13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/private/Files/SimpleFS/SimpleFile.php b/lib/private/Files/SimpleFS/SimpleFile.php
index 7b83e9372f7..9c9ca10650c 100644
--- a/lib/private/Files/SimpleFS/SimpleFile.php
+++ b/lib/private/Files/SimpleFS/SimpleFile.php
@@ -99,9 +99,14 @@ class SimpleFile implements ISimpleFile {
*
* @param string|resource $data
* @throws NotPermittedException
+ * @throws NotFoundException
*/
public function putContent($data) {
- $this->file->putContent($data);
+ try {
+ return $this->file->putContent($data);
+ } catch (NotFoundException $e) {
+ $this->checkFile();
+ }
}
/**
@@ -119,7 +124,11 @@ class SimpleFile implements ISimpleFile {
while ($cur->stat() === false) {
$parent = $cur->getParent();
- $cur->delete();
+ try {
+ $cur->delete();
+ } catch (NotFoundException $e) {
+ // Just continue then
+ }
$cur = $parent;
}