Fix structured data for Radicale 3.6.1#38
Conversation
|
Hi @DiagonalArg, Did a fresh install with During initial setup / login of the admin user, ran into another tuple error on discover(). Apart from that things were working well, so thanks for your help. |
Fix discover() tuple unpacking for Radicale 3 Thanks @m-hobby
|
Updated this PR to include the fix contributed by @m-hobby. This addresses an issue where certain collection metadata was causing synchronization failures in recent Radicale 3.x releases. Technical Note: The fix ensures that the storage provider correctly handles the Item object initialization during the sync process, preventing potential AttributeError or NoneType crashes when DecSync attempts to map local files to Radicale's internal collection structure. |
| self.set_href(item.uid, href) | ||
| # Ensure structured data (lists/tuples) are stringified before serialization | ||
| for component in item.vobject_item.getChildren(): | ||
| if isinstance(component.value, (list, tuple)): |
There was a problem hiding this comment.
Hello!
Thank you for your PR, and also @39aldo39, thank you for the original plugin!
On this very line sometimes the component.value field does not seem to get populated for me, resulting in 500 ISE. With a quick hack, I found a way to get past this:
component_value = getattr(component, 'value', None)
if isinstance(component_value, (list, tuple)):So far it seems working, hope it does not break anything.
Just wanted to jot that down somewhere not to lose it.
There was a problem hiding this comment.
For improved Google-ability, this is what the exception looks like in the logs:
[ERROR] Traceback (most recent call last):
File "/usr/lib/python3.13/site-packages/vobject/base.py", line 533, in __getattr__
return self.contents[toVName(name)][0]
~~~~~~~~~~~~~^^^^^^^^^^^^^^^
KeyError: 'value'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.13/site-packages/radicale/app/__init__.py", line 613, in _handle_request
status, headers, answer, xml_request = function(
~~~~~~~~^
environ, base_prefix, path, user, remote_host, remote_useragent)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.13/site-packages/radicale/app/put.py", line 353, in do_PUT
uploaded_item, replaced_item = parent_item.upload(href, prepared_item)
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/radicale_storage_decsync/__init__.py", line 112, in upload
if isinstance(component.value, (list, tuple)):
^^^^^^^^^^^^^^^
File "/usr/lib/python3.13/site-packages/vobject/base.py", line 535, in __getattr__
raise AttributeError(name)
AttributeError: value
|
@kuklinistvan / please see my new PR, here: Also, note that I am doing maintenance on my repo. You and others are welcome to report issues there: |
Provides update to make the plugin compatible with Radicale 3.6.1 and Python 3.12.3, by fixing a data-integrity bug involving structured vCard fields. Without the added
isinstancecheck, contacts with structured fields (eg. addresses or names) cause a TypeError during serialization, halting the sync process.It has been tested working in:
It is based on JornJorn's fork, which in turn seems to be based on mab122's.