Close the streams in `writeStream` even when there is an exception

Signed-off-by: Robin Appelman <robin@icewind.nl>
pull/20361/head
Robin Appelman 6 years ago
parent 981278a666
commit ccbf3059ba
No known key found for this signature in database
GPG Key ID: 42B69D8A64526EFB
  1. 9
      lib/private/Files/Storage/Common.php

@ -858,9 +858,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…
Cancel
Save