diff options
author | Robin Appelman <robin@icewind.nl> | 2020-07-01 16:37:47 +0300 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2020-07-23 16:24:52 +0300 |
commit | ad7798f9c9066b1eee6ad91526ffab34186f4a7b (patch) | |
tree | 4afb20f9cdbb41ad60cd58fdd146b91a1f1914d0 /lib/private/Files/Storage/Local.php | |
parent | fcad692b4a5dd8e0c128af64647b64f658b124c5 (diff) |
use exceptions for error signaling in writeStream
this remove the ambiguity when writing zero length files
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Files/Storage/Local.php')
-rw-r--r-- | lib/private/Files/Storage/Local.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php index 4cf3ac4799f..0b636d06bde 100644 --- a/lib/private/Files/Storage/Local.php +++ b/lib/private/Files/Storage/Local.php @@ -44,6 +44,7 @@ use OC\Files\Filesystem; use OC\Files\Storage\Wrapper\Jail; use OCP\Constants; use OCP\Files\ForbiddenException; +use OCP\Files\GenericFileException; use OCP\Files\Storage\IStorage; use OCP\ILogger; @@ -553,6 +554,11 @@ class Local extends \OC\Files\Storage\Common { } public function writeStream(string $path, $stream, int $size = null): int { - return (int)file_put_contents($this->getSourcePath($path), $stream); + $result = file_put_contents($this->getSourcePath($path), $stream); + if ($result === false) { + throw new GenericFileException("Failed write steam to $path"); + } else { + return $result; + } } } |