mirror of
https://github.com/nextcloud/server.git
synced 2026-06-12 02:00:51 -04:00
Merge pull request #20494 from nextcloud/backport/20361/stable17
[stable17] Close the streams in `writeStream` even when there is an exception
This commit is contained in:
commit
20b11b8beb
1 changed files with 6 additions and 3 deletions
|
|
@ -853,9 +853,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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue