Do not repeat JSON success code.
This commit is contained in:
parent
0718c92dc8
commit
1ed049a682
1 changed files with 7 additions and 8 deletions
|
@ -76,14 +76,14 @@ if($source) {
|
|||
$eventSource->close();
|
||||
exit();
|
||||
} else {
|
||||
$success = false;
|
||||
if($content) {
|
||||
if(\OC\Files\Filesystem::file_put_contents($target, $content)) {
|
||||
$meta = \OC\Files\Filesystem::getFileInfo($target);
|
||||
$id = $meta['fileid'];
|
||||
OCP\JSON::success(array("data" => array('content'=>$content, 'id' => $id)));
|
||||
exit();
|
||||
}
|
||||
}elseif(\OC\Files\Filesystem::touch($target)) {
|
||||
$success = \OC\Files\Filesystem::file_put_contents($target, $content);
|
||||
} else {
|
||||
$success = \OC\Files\Filesystem::touch($target);
|
||||
}
|
||||
|
||||
if($success) {
|
||||
$meta = \OC\Files\Filesystem::getFileInfo($target);
|
||||
$id = $meta['fileid'];
|
||||
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" )));
|
||||
|
|
Loading…
Reference in a new issue