From: Thomas Tanghus Date: Sun, 8 Jul 2012 12:11:48 +0000 (+0200) Subject: Return error messages in correct format. X-Git-Tag: v4.5.0beta1~74^2~225^2~10 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e6a60198e429adf4c7fae261109ae09a9045f733;p=nextcloud-server.git Return error messages in correct format. --- diff --git a/apps/contacts/import.php b/apps/contacts/import.php index c95fd970fe1..22f33d71576 100644 --- a/apps/contacts/import.php +++ b/apps/contacts/import.php @@ -35,20 +35,20 @@ if(isset($_POST['fstype']) && $_POST['fstype'] == 'OC_FilesystemView') { $file = OC_Filesystem::file_get_contents($_POST['path'] . '/' . $_POST['file']); } if(!$file) { - OCP\JSON::error(array('message' => 'Import file was empty.')); + OCP\JSON::error(array('data' => array('message' => 'Import file was empty.'))); exit(); } if(isset($_POST['method']) && $_POST['method'] == 'new'){ $id = OC_Contacts_Addressbook::add(OCP\USER::getUser(), $_POST['addressbookname']); if(!$id) { - OCP\JSON::error(array('message' => 'Error creating address book.')); + OCP\JSON::error(array('data' => array('message' => 'Error creating address book.'))); exit(); } OC_Contacts_Addressbook::setActive($id, 1); }else{ $id = $_POST['id']; if(!$id) { - OCP\JSON::error(array('message' => 'Error getting the ID of the address book.')); + OCP\JSON::error(array('data' => array('message' => 'Error getting the ID of the address book.'))); exit(); } OC_Contacts_App::getAddressbook($id); // is owner access check @@ -77,7 +77,7 @@ writeProgress('70'); $imported = 0; $failed = 0; if(!count($parts) > 0) { - OCP\JSON::error(array('message' => 'No contacts to import in .'.$_POST['file'].' Please check if the file is corrupted.')); + OCP\JSON::error(array('data' => array('message' => 'No contacts to import in .'.$_POST['file'].' Please check if the file is corrupted.'))); exit(); } foreach($parts as $part){