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:
authorChristoph Wurst <ChristophWurst@users.noreply.github.com>2020-04-15 11:48:24 +0300
committerGitHub <noreply@github.com>2020-04-15 11:48:24 +0300
commit301327135c2ac53182696f122f665d15e1df6e75 (patch)
treeb77f54664dbbf2fe5fafb5753f8f122b9c2c72cd /lib
parentd63abebc937583f2f97e58dc2887d88b6c6d13ee (diff)
parentccbf3059ba6cb497f2337f6eb348e52189c4915a (diff)
Merge pull request #20361 from nextcloud/write-stream-close-on-exception
Close the streams in `writeStream` even when there is an exception
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Files/Storage/Common.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php
index edad9cc874c..bb672f3a0ea 100644
--- a/lib/private/Files/Storage/Common.php
+++ b/lib/private/Files/Storage/Common.php
@@ -859,9 +859,12 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage {
if (!$target) {
return 0;
}
- list($count, $result) = \OC_Helper::streamCopy($stream, $target);
- fclose($stream);
- fclose($target);
+ try {
+ [$count, $result] = \OC_Helper::streamCopy($stream, $target);
+ } finally {
+ fclose($target);
+ fclose($stream);
+ }
return $count;
}
}