Avoid decoding of old-style (non-encoded) address book identifiers

This commit is contained in:
Thomas Bruederli 2014-06-27 12:05:39 +02:00
parent d777456fcf
commit 6665b7877b

View file

@ -370,9 +370,12 @@ class kolab_addressbook extends rcube_plugin
$p['instance'] = $this->sources[$p['id']]; $p['instance'] = $this->sources[$p['id']];
} }
else { else {
$folder = kolab_storage::get_folder(kolab_storage::id_decode($p['id'])); $id = kolab_storage::id_decode($p['id']);
if ($folder->type) { // try with unencoded (old-style) identifier if (preg_match('![^A-Za-z0-9/+=]!', $id)) // check for falsely base64 decoded identifier
$folder = kolab_storage::get_folder(kolab_storage::id_decode($p['id'], false)); $id = $p['id'];
$folder = kolab_storage::get_folder($id);
if (!$folder->type && $id != $p['id']) { // try with unencoded (old-style) identifier
$folder = kolab_storage::get_folder($p['id']);
} }
if ($folder->type) { if ($folder->type) {
$this->sources[$p['id']] = new rcube_kolab_contacts($folder->name); $this->sources[$p['id']] = new rcube_kolab_contacts($folder->name);