# Fix Android "bug" with UIDs/URIs on CardDav contacts ## Overview I recently experienced a strange bug on Android 5.1, when trying to sync my owncloud contacts through DAVDroid. Only some of my contacts would get sync-ed... I finally figured it was because of the domain being included in the UIDs (or URIs) of the vCard in the DB. Example: `01234567-89ab-cdef-0123-456789abcdef@MY_OC_DOMAIN`. Manually changing the ID to `01234567-89ab-cdef-0123-456789abcdef` in the database would fix it. I made a quick PHP script to update my DB. ## Fix Disclaimer: Although it worked fine for me, I can't be held responsible if it destroys your contact list...
uri) && strpos($rs->uri,__offStr);
        $b = !empty($rs->carddata) && strpos($rs->carddata,__offStr);
        if($a || $b) 
        {
                $r = 'update oc_contacts_cards set';
                if($a)  
                        $r .= ' uri=\''.mysql_real_escape_string(str_replace(__offStr,'',$rs->uri)).'\',';
                if($b)
                        $r .= ' carddata=\''.mysql_real_escape_string(str_replace(__offStr,'',$rs->carddata)).'\',';
                $r .= ' id='.$rs->id.' where id='.$rs->id;      
                $rq = mysql_query($r) or die(mysql_error());
                #var_dump($rs->id);
                #var_dump($n_cd);
                #var_dump($n_uri);
                #var_dump($r);
                #echo '
'; $n++; } } var_dump('Updated '.$n.' of '.$t.' contacts'); ?>