fix: convert BDAY datetime.date to string before Pydantic validation
pythonvCard4 parses vCard BDAY fields into datetime.date objects, but the Contact model expects Optional[str]. This caused a validation error that crashed the entire contact list. Convert at the client layer (consistent with the calendar client pattern) with a defensive check at the server mapping layer. Closes #672 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
97ae750916
commit
da380a38c6
@@ -2,6 +2,7 @@
|
||||
|
||||
import logging
|
||||
import xml.etree.ElementTree as ET
|
||||
from datetime import date
|
||||
|
||||
from pythonvCard4.vcard import Contact
|
||||
|
||||
@@ -272,7 +273,9 @@ class ContactsClient(BaseNextcloudClient):
|
||||
"contact": {
|
||||
"fullname": contact.fn,
|
||||
"nickname": contact.nickname,
|
||||
"birthday": contact.bday,
|
||||
"birthday": contact.bday.isoformat()
|
||||
if isinstance(contact.bday, date)
|
||||
else contact.bday,
|
||||
"email": contact.email,
|
||||
"tel": contact.tel,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user