Do not repeat JSON success code.
This commit is contained in:
parent
0718c92dc8
commit
1ed049a682
|
@ -76,14 +76,14 @@ if($source) {
|
||||||
$eventSource->close();
|
$eventSource->close();
|
||||||
exit();
|
exit();
|
||||||
} else {
|
} else {
|
||||||
|
$success = false;
|
||||||
if($content) {
|
if($content) {
|
||||||
if(\OC\Files\Filesystem::file_put_contents($target, $content)) {
|
$success = \OC\Files\Filesystem::file_put_contents($target, $content);
|
||||||
$meta = \OC\Files\Filesystem::getFileInfo($target);
|
} else {
|
||||||
$id = $meta['fileid'];
|
$success = \OC\Files\Filesystem::touch($target);
|
||||||
OCP\JSON::success(array("data" => array('content'=>$content, 'id' => $id)));
|
|
||||||
exit();
|
|
||||||
}
|
}
|
||||||
}elseif(\OC\Files\Filesystem::touch($target)) {
|
|
||||||
|
if($success) {
|
||||||
$meta = \OC\Files\Filesystem::getFileInfo($target);
|
$meta = \OC\Files\Filesystem::getFileInfo($target);
|
||||||
$id = $meta['fileid'];
|
$id = $meta['fileid'];
|
||||||
OCP\JSON::success(array("data" => array('content'=>$content, 'id' => $id, 'mime' => $meta['mimetype'])));
|
OCP\JSON::success(array("data" => array('content'=>$content, 'id' => $id, 'mime' => $meta['mimetype'])));
|
||||||
|
@ -91,5 +91,4 @@ if($source) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
OCP\JSON::error(array("data" => array( "message" => "Error when creating the file" )));
|
OCP\JSON::error(array("data" => array( "message" => "Error when creating the file" )));
|
||||||
|
|
Loading…
Reference in New Issue