diff options
author | Julius Härtl <jus@bitgrid.net> | 2021-10-11 23:23:14 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-11 23:23:14 +0300 |
commit | e59f90d6ba70f7ab413ac5fe720c3a09eea0f38f (patch) | |
tree | cf6abe32a3e46300520cff8cbb9d11c9a148eb1c /lib/private | |
parent | 6039a43d138b6505a2bde71d96a22bf542974c8b (diff) | |
parent | b77b1d6bbdd233b4cff7d7667b95a834195c30ce (diff) |
Merge pull request #29134 from nextcloud/backport/28907/stable21
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/Files/Storage/Local.php | 5 | ||||
-rw-r--r-- | lib/private/Files/Storage/Wrapper/Encryption.php | 5 |
2 files changed, 7 insertions, 3 deletions
diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php index a29fc6c02de..4df16b206a5 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; } diff --git a/lib/private/Files/Storage/Wrapper/Encryption.php b/lib/private/Files/Storage/Wrapper/Encryption.php index 64c9b0a4a66..125338a290d 100644 --- a/lib/private/Files/Storage/Wrapper/Encryption.php +++ b/lib/private/Files/Storage/Wrapper/Encryption.php @@ -926,10 +926,10 @@ class Encryption extends Wrapper { } $result = []; - + // first check if it is an encrypted file at all // We would do query to filecache only if we know that entry in filecache exists - + $info = $this->getCache()->get($path); if (isset($info['encrypted']) && $info['encrypted'] === true) { $firstBlock = $this->readFirstBlock($path); @@ -1033,6 +1033,7 @@ class Encryption extends Wrapper { // always fall back to fopen $target = $this->fopen($path, 'w'); [$count, $result] = \OC_Helper::streamCopy($stream, $target); + fclose($stream); fclose($target); return $count; } |