diff options
author | Robin Appelman <robin@icewind.nl> | 2020-04-08 16:40:56 +0200 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2020-04-15 08:49:53 +0000 |
commit | adf88bb418e0e09959d27393f173e3d848bb9a2c (patch) | |
tree | 5249d934d513f1f5b6b22324d7ffbc9a86d6309b /lib | |
parent | 7d412b5733add714f589b761fa36fcc98039c2eb (diff) | |
download | nextcloud-server-adf88bb418e0e09959d27393f173e3d848bb9a2c.tar.gz nextcloud-server-adf88bb418e0e09959d27393f173e3d848bb9a2c.zip |
Close the streams in `writeStream` even when there is an exception
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Files/Storage/Common.php | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php index 8760fae1185..82ac49b9fdf 100644 --- a/lib/private/Files/Storage/Common.php +++ b/lib/private/Files/Storage/Common.php @@ -857,9 +857,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; } } |