comparison mod_lib_ldap/dev/t/02-vcard.t @ 828:855b28e10b39

Fix vCard checking routine to handle avatars properly
author Rob Hoelz <rob@hoelz.ro>
date Tue, 18 Sep 2012 00:14:31 +0200
parents e801edea846a
children 9c134ff07d0f
comparison
equal deleted inserted replaced
827:e801edea846a 828:855b28e10b39
33 if($error) { 33 if($error) {
34 $conn->cond->send($error->string); 34 $conn->cond->send($error->string);
35 return; 35 return;
36 } 36 }
37 37
38 delete $vcard->{'_avatar_hash'}; # we don't check this
39 delete $vcard->{'PHOTO'}; # PHOTO data is treated specially
40 # by the vCard extension
41
38 foreach my $key (keys %$vcard) { 42 foreach my $key (keys %$vcard) {
39 my $value = $vcard->{$key}; 43 my $value = $vcard->{$key};
40 44
41 $value = $value->[0]; 45 $value = $value->[0] if ref($value) eq 'ARRAY';
42 46
43 if($value eq '') { 47 if($value eq '') {
44 delete $vcard->{$key}; 48 delete $vcard->{$key};
45 } else { 49 } else {
46 $vcard->{$key} = $value; 50 $vcard->{$key} = $value;