You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Parsing a string containing two name fields ("N:") doesn't produce an error but silently ignores the name fields and produces a VCard with name() returning None:
use vobject::vcard::Vcard;
fn main() {
let input = "\
BEGIN:VCARD\r\n\
VERSION:3.0\r\n\
FN:Test person\r\n\
N:Person;Test;;;\r\n\
N:P;Test;;;\r\n\
TEL:+30666777888\r\n\
TEL:+34666777888\r\n\
TEL:+33666777888\r\n\
EMAIL;TYPE=INTERNET:[email protected]\r\n\
EMAIL;TYPE=INTERNET:[email protected]\r\n\
END:VCARD\r\n\
";
let vcard = Vcard::build(input).unwrap();
assert!(vcard.name().is_some());
}
When executed, the code above panics due to the assertion:
thread 'main' panicked at 'assertion failed: vcard.name().is_some()', src/main.rs:18:5
A pretty print shows that both "N:" fields are effectively parsed and added to the underlying Component:
I think the problem is that vcard.name() is implemented by make_getter_function_for_optional! but it should be implemented by make_getter_function_for_values! instead. If you read these macros you can see that you might be able to get all N values with something like vcard.get_all("N").
Parsing a string containing two name fields ("N:") doesn't produce an error but silently ignores the name fields and produces a VCard with
name()
returningNone
:When executed, the code above panics due to the assertion:
A pretty print shows that both "N:" fields are effectively parsed and added to the underlying Component:
Shouldn't either the parser return a parsing error or name() return Some(Name)?
The text was updated successfully, but these errors were encountered: