Properly catch exception from writing to stream when copying a file
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
parent
c8381c5d17
commit
f5dec3702b
|
@ -51,6 +51,7 @@ use OCP\Encryption\Exceptions\GenericEncryptionException;
|
||||||
use OCP\Files\EntityTooLargeException;
|
use OCP\Files\EntityTooLargeException;
|
||||||
use OCP\Files\FileInfo;
|
use OCP\Files\FileInfo;
|
||||||
use OCP\Files\ForbiddenException;
|
use OCP\Files\ForbiddenException;
|
||||||
|
use OCP\Files\GenericFileException;
|
||||||
use OCP\Files\InvalidContentException;
|
use OCP\Files\InvalidContentException;
|
||||||
use OCP\Files\InvalidPathException;
|
use OCP\Files\InvalidPathException;
|
||||||
use OCP\Files\LockNotAcquiredException;
|
use OCP\Files\LockNotAcquiredException;
|
||||||
|
@ -199,8 +200,14 @@ class File extends Node implements IFile {
|
||||||
$isEOF = feof($stream);
|
$isEOF = feof($stream);
|
||||||
});
|
});
|
||||||
|
|
||||||
$count = $partStorage->writeStream($internalPartPath, $wrappedData);
|
$result = true;
|
||||||
$result = $count > 0;
|
$count = -1;
|
||||||
|
try {
|
||||||
|
$count = $partStorage->writeStream($internalPartPath, $wrappedData);
|
||||||
|
} catch (GenericFileException $e) {
|
||||||
|
$result = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
$result = $isEOF;
|
$result = $isEOF;
|
||||||
|
|
Loading…
Reference in New Issue