From e60a829b42f0f4b74db835d8e10438a33e125051 Mon Sep 17 00:00:00 2001 From: Daniel Kesselberg Date: Mon, 20 Sep 2021 19:20:51 +0200 Subject: explicitly close source stream on local storage Signed-off-by: Daniel Kesselberg --- lib/private/Files/Storage/Local.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php index ccd331f515f..eea04bd8676 100644 --- a/lib/private/Files/Storage/Local.php +++ b/lib/private/Files/Storage/Local.php @@ -568,8 +568,11 @@ class Local extends \OC\Files\Storage\Common { public function writeStream(string $path, $stream, int $size = null): int { $result = $this->file_put_contents($path, $stream); + if (is_resource($stream)) { + fclose($stream); + } if ($result === false) { - throw new GenericFileException("Failed write steam to $path"); + throw new GenericFileException("Failed write stream to $path"); } else { return $result; } -- cgit v1.2.3