Skip to content
Snippets Groups Projects
Commit 1ed049a6 authored by Andreas Fischer's avatar Andreas Fischer
Browse files

Do not repeat JSON success code.

parent 0718c92d
No related branches found
No related tags found
No related merge requests found
......@@ -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" )));
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment