Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trailing semicolons ;;; in Name/N are reported as invalid #515

Open
Maxim-Mazurok opened this issue Oct 9, 2020 · 2 comments
Open

Trailing semicolons ;;; in Name/N are reported as invalid #515

Maxim-Mazurok opened this issue Oct 9, 2020 · 2 comments

Comments

@Maxim-Mazurok
Copy link

Maxim-Mazurok commented Oct 9, 2020

I have this vCard, generated by ez-vcard and it has no trailing semicolons for the N field:

BEGIN:VCARD
VERSION:2.1
N:Mazurok;Maxim
END:VCARD

But when I try to validate it like so:

$vcard = VObject\Reader::read(
    fopen(__DIR__ . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . "vcard.vcf", "r")
  );
$result = $vcard->validate(Sabre\VObject\Node::REPAIR);

it gives me a validation error and when I call $vcard->serialize(), it suggests to use this instead (with trailing semicolons):

BEGIN:VCARD
VERSION:2.1
N:Mazurok;Maxim;;;
END:VCARD

As mentioned in mangstadt/ez-vcard#57 (comment), it's ok to trim trailing semicolons in the N field:

vCard 2.1 spec gives an example without the trailing semi-colons:

N:Veni, Vidi, Vici;The Restaurant.

So, should we fix this, or I'm just not using some optional arguments for validation?... I don't want validation to be forgiving, though. I want my vCard to be as close to spec, as possible.

Cheers!

@Maxim-Mazurok
Copy link
Author

Maxim-Mazurok commented Oct 9, 2020

Looks like this is specifically by design:

* N must for instance be represented as 5 components, separated by ;, even
* if the last few components are unused.

@Maxim-Mazurok
Copy link
Author

Looks like it was added by @evert in 0806a46

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant