Merge pull request #20361 from nextcloud/write-stream-close-on-exception
Close the streams in `writeStream` even when there is an exception
This commit is contained in:
commit
301327135c
|
@ -859,9 +859,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 New Issue