diff options
author | Andreas Fischer <bantu@owncloud.com> | 2013-08-08 21:27:59 +0200 |
---|---|---|
committer | Andreas Fischer <bantu@owncloud.com> | 2013-08-08 22:14:21 +0200 |
commit | 1ed049a6828149e00d424a3dac87b3d1b1777d6a (patch) | |
tree | e95d36cdbaa48a73d73c1a6ccf4a5a851cf23267 | |
parent | 0718c92dc805f7379b1dbffcd35155dc7e828b9f (diff) | |
download | nextcloud-server-1ed049a6828149e00d424a3dac87b3d1b1777d6a.tar.gz nextcloud-server-1ed049a6828149e00d424a3dac87b3d1b1777d6a.zip |
Do not repeat JSON success code.
-rw-r--r-- | apps/files/ajax/newfile.php | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/apps/files/ajax/newfile.php b/apps/files/ajax/newfile.php index 8ee4888b34d..22598ee78e1 100644 --- a/apps/files/ajax/newfile.php +++ b/apps/files/ajax/newfile.php @@ -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" ))); |