summaryrefslogtreecommitdiffstats
path: root/apps/contacts/ajax/updateaddressbook.php
diff options
context:
space:
mode:
authorThomas Tanghus <thomas@tanghus.net>2012-02-20 15:24:54 +0100
committerThomas Tanghus <thomas@tanghus.net>2012-02-20 15:24:54 +0100
commitffdfe8257bb89750352553e71e863843e2416925 (patch)
tree9ed69da6cea084c06db64087926220d52cbffbef /apps/contacts/ajax/updateaddressbook.php
parent456ada01fa44a5de3146f58ea5de60baffe31521 (diff)
downloadnextcloud-server-ffdfe8257bb89750352553e71e863843e2416925.tar.gz
nextcloud-server-ffdfe8257bb89750352553e71e863843e2416925.zip
Contacts: Fix adding/updating address book with empty name.
Diffstat (limited to 'apps/contacts/ajax/updateaddressbook.php')
-rw-r--r--apps/contacts/ajax/updateaddressbook.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/apps/contacts/ajax/updateaddressbook.php b/apps/contacts/ajax/updateaddressbook.php
index b43b5b93a32..211df84b1d1 100644
--- a/apps/contacts/ajax/updateaddressbook.php
+++ b/apps/contacts/ajax/updateaddressbook.php
@@ -15,7 +15,14 @@ OC_JSON::checkAppEnabled('contacts');
$bookid = $_POST['id'];
OC_Contacts_App::getAddressbook($bookid); // is owner access check
-if(!OC_Contacts_Addressbook::edit($bookid, $_POST['name'], null)) {
+$name = trim(strip_tags($_POST['name']));
+if(!$name) {
+ OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Cannot update addressbook with an empty name.'))));
+ OC_Log::write('contacts','ajax/updateaddressbook.php: Cannot update addressbook with an empty name: '.strip_tags($_POST['name']), OC_Log::ERROR);
+ exit();
+}
+
+if(!OC_Contacts_Addressbook::edit($bookid, $name, null)) {
OC_JSON::error(array('data' => array('message' => $l->t('Error updating addressbook.'))));
OC_Log::write('contacts','ajax/updateaddressbook.php: Error adding addressbook: ', OC_Log::ERROR);
//exit();