aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files
diff options
context:
space:
mode:
authorDaniel Kesselberg <mail@danielkesselberg.de>2021-09-20 19:20:51 +0200
committerDaniel Kesselberg <mail@danielkesselberg.de>2021-09-21 17:41:59 +0200
commite60a829b42f0f4b74db835d8e10438a33e125051 (patch)
tree93baede211fab7cc615dc3b3e6418648e41e55da /lib/private/Files
parentdbf7905149222115a2cd0334efcf8c93afa8683e (diff)
downloadnextcloud-server-e60a829b42f0f4b74db835d8e10438a33e125051.tar.gz
nextcloud-server-e60a829b42f0f4b74db835d8e10438a33e125051.zip
explicitly close source stream on local storage
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Diffstat (limited to 'lib/private/Files')
-rw-r--r--lib/private/Files/Storage/Local.php5
1 files changed, 4 insertions, 1 deletions
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;
}