Kozea / Radicale

A simple CalDAV (calendar) and CardDAV (contact) server.
https://radicale.org
GNU General Public License v3.0
3.35k stars 435 forks source link

How to publish existing WebDAV calendar to Radicale #956

Closed jmfoleyjr closed 1 month ago

jmfoleyjr commented 5 years ago

This is surely a newbie question, but I've spent several hours searching and experimenting, so I need help. I have and existing WebDAV calendar .ics file. I want to now publish it to radicale/CalDAV. I have successfully created new CalDAV calendars with radicale, but they have been empty. I've tried simply publishing the WebDAV cal to https://mydom.org:5232/OfficeCalendar, but I get error (below). My rights file is:

# All authenticated users can update the Conference Room Calendar
[conference]
user = .+
collection = ConferenceCalendar(/.*)?
permission = rw

# All authenticated users can update the Office Calendar
[office]
user = .+
collection = OfficeCalendar(/.*)?
permission = rw

The ConferenceCalendar works fine, but that started empty and I didn't have any authentication or rights. The OfficeCalendar is the new one I want to create. When I tried publishing the WebDAV version of this, I used the URL https://mydom.org:5232/OfficeCalendar and got the following error with radicale -D:

[7f86cd85d700] DEBUG: Sanitized script name: ''
[7f86cd85d700] DEBUG: Sanitized path: '/OfficeCalendar'
[7f86cd85d700] DEBUG: Rule '':'OfficeCalendar' doesn't match '.+':'ConferenceCalendar(/.*)?' from section 'conference'
[7f86cd85d700] DEBUG: Rule '':'OfficeCalendar' doesn't match '.+':'OfficeCalendar(/.*)?' from section 'office'
[7f86cd85d700] INFO: Rights: '':'OfficeCalendar' doesn't match any section
[7f86cd85d700] DEBUG: Rule '':'' doesn't match '.+':'ConferenceCalendar(/.*)?' from section 'conference'
[7f86cd85d700] DEBUG: Rule '':'' doesn't match '.+':'OfficeCalendar(/.*)?' from section 'office'
[7f86cd85d700] INFO: Rights: '':'' doesn't match any section
[7f86cd85d700] INFO: Access to '/OfficeCalendar' denied for anonymous user
[7f86cd85d700] DEBUG: Asking client for authentication
[7f86cd85d700] DEBUG: Response content:
Access to the requested resource forbidden.
[7f86cd85d700] INFO: PUT response status for '/OfficeCalendar' in 0.002 seconds: 401 Unauthorized

How should I do this?

jmfoleyjr commented 5 years ago

More problems. I tried creating a new calendar using the webpage https://mydom.org/5232. I got the errors:

[7f92ee51b700] DEBUG: Sanitized script name: ''
[7f92ee51b700] DEBUG: Sanitized path: '/'
[7f92ee51b700] INFO: Successful login: 'shay'
[7f92ee51b700] DEBUG: Rule 'shay':'shay' doesn't match '.+':'ConferenceCalendar(/.*)?' from section 'conference'
[7f92ee51b700] DEBUG: Rule 'shay':'shay' doesn't match '.+':'OfficeCalendar(/.*)?' from section 'office'
[7f92ee51b700] INFO: Rights: 'shay':'shay' doesn't match any section
[7f92ee51b700] WARNING: Access to principal path '/shay/' denied by rights backend
[7f92ee51b700] DEBUG: Rule 'shay':'' doesn't match '.+':'ConferenceCalendar(/.*)?' from section 'conference'
[7f92ee51b700] DEBUG: Rule 'shay':'' doesn't match '.+':'OfficeCalendar(/.*)?' from section 'office'
[7f92ee51b700] INFO: Rights: 'shay':'' doesn't match any section
[7f92ee51b700] DEBUG: Rule 'shay':'' doesn't match '.+':'ConferenceCalendar(/.*)?' from section 'conference'
[7f92ee51b700] DEBUG: Rule 'shay':'' doesn't match '.+':'OfficeCalendar(/.*)?' from section 'office'
[7f92ee51b700] INFO: Rights: 'shay':'' doesn't match any section
[7f92ee51b700] INFO: Access to '/' denied for 'shay'
[7f92ee51b700] DEBUG: Response content:
Access to the requested resource forbidden.
[7f92ee51b700] INFO: PROPFIND response status for '/' in 0.043 seconds: 403 Forbidden

I added the following to the rights file, but that didn't help:

# Authenticated users can read and write their own collections.
[owner-write]
user = .+
collection = %(login)s(/.*)?
permission = rw

Next, in the config, I set auth type = none, and rights type = none. That permitted me to log in and I was able to create a new (empty) calendar named as the user's ID. Is that really what you have to do? Disable authentication and rights?

I was then able to publish a small WebDAV calendar to radicale.

I cleared out that test calendar and tried to publish the Thunderbird/Lightning calendar I really wanted which has 253 events. That failed with the error shown below. I tried deleting the event listed immediately above the error output, but that didn't work. I can't tell if the last event listed on the debug output is the one causing the error or the last successfully processed event. I also tried first publishing this calendar to the WebDAV server (the publishing process cleans up some errors), then publishing that WebDAV calendar to radicale, but same failure: "can't compare offset-naive and offset-aware datetimes". Is this a bug in the radicale program?

Debug output:

[7fbadaec0700] WARNING: Bad PUT request on '/shay/6a5abc1d-9a01-1c42-9453-c987a8c38343/': Failed to store item '1b15cb08-a429-bdbb-778b-333765d10b5.ics' in temporary collection 'shay/6a5abc1d-9a01-1c42-9453-c987a8c38343': can't compare offset-naive and offset-aware datetimes
Traceback (most recent call last):
  File "/usr/lib64/python3.7/site-packages/radicale/storage.py", line 1045, in _upload_all_nonatomic
    cache_content = self._item_cache_content(vobject_item)
  File "/usr/lib64/python3.7/site-packages/radicale/storage.py", line 1298, in _item_cache_content
    tag, start, end = xmlutils.find_tag_and_time_range(vobject_item)
  File "/usr/lib64/python3.7/site-packages/radicale/xmlutils.py", line 688, in find_tag_and_time_range
    _visit_time_ranges(vobject_item, tag, range_fn, infinity_fn)
  File "/usr/lib64/python3.7/site-packages/radicale/xmlutils.py", line 343, in _visit_time_ranges
    dtstarts, infinity = getrruleset(child, recurrences)
  File "/usr/lib64/python3.7/site-packages/radicale/xmlutils.py", line 308, in getrruleset
    for dtstart in child.getrruleset(addRDate=True):
  File "/usr/lib64/python3.7/site-packages/dateutil/rrule.py", line 1389, in _iter
    self._exdate.sort()
TypeError: can't compare offset-naive and offset-aware datetimes

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib64/python3.7/site-packages/radicale/__init__.py", line 935, in do_PUT
    path, items, props)
  File "/usr/lib64/python3.7/site-packages/radicale/storage.py", line 1006, in create_collection
    self._upload_all_nonatomic(vobject_items)
  File "/usr/lib64/python3.7/site-packages/radicale/storage.py", line 1050, in _upload_all_nonatomic
    (href, self.path, e)) from e
ValueError: Failed to store item '1b15cb08-a429-bdbb-778b-333765d10b5.ics' in temporary collection 'shay/6a5abc1d-9a01-1c42-9453-c987a8c38343': can't compare offset-naive and offset-aware datetimes
[7fbadaec0700] DEBUG: Response content:
Bad Request
[7fbadaec0700] INFO: PUT response status for '/shay/6a5abc1d-9a01-1c42-9453-c987a8c38343/' in 1.305 seconds: 400 Bad Request

Dead in the water at the moment.

jmfoleyjr commented 5 years ago

After tediously searching through the 253 events in the OfficeCalendar.ics file, I finally located the event causing the "400 Bad Request" error. When I removed it I was able to publish the calendar. I am going create a new issue summarizing the problem I encountered in creating and publishing a calendar as this issue is too long and involved to expect anyone to wade through everything. For reference, here is the event that caused the "400 Bad Request" error: This is from publishing a Thunderbird/Lightning calendar to an .ics file.

BEGIN:VEVENT
CREATED:20121130T140417Z
LAST-MODIFIED:20190520T184820Z
DTSTAMP:20190520T184820Z
UID:040000008200E00074C5B7101A82E0080000000060475654E799D00100000000000000
 0010000000B189A8B23EB5F945987CFBA905F18E79
SUMMARY:Doris - early day
PRIORITY:5
EXDATE;VALUE=DATE:20121130
EXDATE;VALUE=DATE:20121214
EXDATE;VALUE=DATE:20121228
EXDATE;VALUE=DATE:20130111
EXDATE;VALUE=DATE:20130308
EXDATE;VALUE=DATE:20130628
EXDATE;VALUE=DATE:20130823
EXDATE;VALUE=DATE:20131115
EXDATE;VALUE=DATE:20131129
EXDATE;VALUE=DATE:20131213
EXDATE;VALUE=DATE:20131227
EXDATE;VALUE=DATE:20140110
EXDATE;VALUE=DATE:20140516
EXDATE;VALUE=DATE:20140530
EXDATE;VALUE=DATE:20140613
EXDATE;VALUE=DATE:20140627
EXDATE;VALUE=DATE:20140711
EXDATE;VALUE=DATE:20140725
EXDATE;VALUE=DATE:20140808
EXDATE;VALUE=DATE:20140822
EXDATE;VALUE=DATE:20140905
EXDATE;VALUE=DATE:20140919
EXDATE;VALUE=DATE:20141003
EXDATE;VALUE=DATE:20141017
EXDATE;VALUE=DATE:20141031
EXDATE;VALUE=DATE:20141114
EXDATE;VALUE=DATE:20141128
EXDATE;VALUE=DATE:20141212
EXDATE;VALUE=DATE:20141226
EXDATE;VALUE=DATE:20150109
EXDATE;VALUE=DATE:20150123
EXDATE;VALUE=DATE:20150206
EXDATE;VALUE=DATE:20150220
EXDATE;VALUE=DATE:20150306
EXDATE;VALUE=DATE:20150320
EXDATE;VALUE=DATE:20150403
EXDATE;VALUE=DATE:20150417
EXDATE;VALUE=DATE:20150501
EXDATE;VALUE=DATE:20150515
EXDATE;VALUE=DATE:20150529
EXDATE;VALUE=DATE:20150612
EXDATE;VALUE=DATE:20150626
EXDATE;VALUE=DATE:20150710
EXDATE;VALUE=DATE:20150724
EXDATE;VALUE=DATE:20150807
EXDATE;VALUE=DATE:20150821
EXDATE;VALUE=DATE:20150904
EXDATE;VALUE=DATE:20150918
EXDATE;VALUE=DATE:20151002
EXDATE;VALUE=DATE:20160122
EXDATE;VALUE=DATE:20160219
RRULE:FREQ=WEEKLY;INTERVAL=2;BYDAY=FR;WKST=SU
EXDATE;VALUE=DATE:20160513
EXDATE;VALUE=DATE:20160708
EXDATE;VALUE=DATE:20160610
EXDATE;VALUE=DATE:20160624
EXDATE;VALUE=DATE:20160722
EXDATE;VALUE=DATE:20160819
EXDATE;VALUE=DATE:20161111
EXDATE;VALUE=DATE:20161125
EXDATE;VALUE=DATE:20170106
EXDATE;VALUE=DATE:20171110
EXDATE;VALUE=DATE:20171124
EXDATE;VALUE=DATE:20170120
EXDATE:20161223T190000Z
EXDATE:20170707T180000Z
EXDATE:20180105T190000Z
EXDATE:20151016T180000Z
EXDATE:20151030T180000Z
EXDATE:20151113T190000Z
EXDATE:20151127T190000Z
EXDATE:20151211T190000Z
EXDATE:20151225T190000Z
EXDATE:20160108T190000Z
EXDATE:20160205T190000Z
EXDATE:20160304T190000Z
EXDATE:20160318T180000Z
EXDATE:20160401T180000Z
EXDATE:20160415T180000Z
EXDATE:20160429T180000Z
EXDATE:20160527T180000Z
EXDATE:20160805T180000Z
EXDATE:20160902T180000Z
EXDATE:20160916T180000Z
EXDATE:20160930T180000Z
EXDATE:20161014T180000Z
EXDATE:20161028T180000Z
EXDATE:20161209T190000Z
EXDATE:20170428T180000Z
EXDATE:20170609T180000Z
EXDATE:20170512T180000Z
EXDATE:20170203T190000Z
EXDATE:20170217T190000Z
EXDATE:20170303T190000Z
EXDATE:20170317T180000Z
EXDATE:20170331T180000Z
EXDATE:20170414T180000Z
EXDATE:20170526T180000Z
EXDATE:20170901T180000Z
EXDATE:20170623T180000Z
EXDATE:20171222T190000Z
EXDATE:20171208T190000Z
EXDATE:20180119T190000Z
EXDATE:20180706T180000Z
EXDATE:20181123T190000Z
EXDATE:20190104T190000Z
EXDATE:20170721T180000Z
EXDATE:20170804T180000Z
EXDATE:20170818T180000Z
EXDATE:20180202T190000Z
EXDATE:20170915T180000Z
EXDATE:20170929T180000Z
EXDATE:20180216T190000Z
EXDATE:20180302T190000Z
EXDATE:20171013T180000Z
EXDATE:20171027T180000Z
EXDATE:20180608T180000Z
EXDATE:20180316T180000Z
EXDATE:20180330T180000Z
EXDATE:20180817T180000Z
EXDATE:20180413T180000Z
EXDATE:20180427T180000Z
EXDATE:20180511T180000Z
EXDATE:20180525T180000Z
EXDATE:20181221T190000Z
EXDATE:20180622T180000Z
EXDATE:20190621T180000Z
EXDATE:20190816T180000Z
EXDATE:20191220T190000Z
EXDATE:20200103T190000Z
EXDATE:20190705T180000Z
EXDATE:20180720T180000Z
EXDATE:20180803T180000Z
EXDATE:20180831T180000Z
EXDATE:20140124T190000Z
EXDATE:20140207T190000Z
EXDATE:20140221T190000Z
EXDATE:20140307T190000Z
EXDATE:20140321T180000Z
EXDATE:20140404T180000Z
EXDATE:20140418T180000Z
EXDATE:20140502T180000Z
EXDATE:20130920T180000Z
EXDATE:20131101T180000Z
EXDATE:20131018T180000Z
EXDATE:20131004T180000Z
EXDATE;VALUE=DATE:20131004
EXDATE:20130906T180000Z
EXDATE:20130809T180000Z
EXDATE:20130726T180000Z
EXDATE:20130712T180000Z
EXDATE:20130614T180000Z
EXDATE:20130531T180000Z
EXDATE:20130517T180000Z
EXDATE:20130503T180000Z
EXDATE:20130419T180000Z
EXDATE:20130405T180000Z
EXDATE:20130322T180000Z
EXDATE:20130222T190000Z
EXDATE:20130208T190000Z
EXDATE:20130125T190000Z
EXDATE:20180914T180000Z
EXDATE:20180928T180000Z
EXDATE:20181012T180000Z
EXDATE:20181026T180000Z
EXDATE:20181109T190000Z
EXDATE:20190426T180000Z
EXDATE:20181207T190000Z
CATEGORIES:Follow up
DTSTART;TZID=America/New_York:20121130T140000
DTEND;TZID=America/New_York:20121130T163000
CLASS:PUBLIC
DESCRIPTION:leave approximately 2:00\n
SEQUENCE:117
TRANSP:OPAQUE
X-ALT-DESC:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">\n<HTML>\n<HEA
 D>\n<META NAME="Generator" CONTENT="MS Exchange Server version 14.02.5004.
 000">\n<TITLE></TITLE>\n</HEAD>\n<BODY>\n<!-- Converted from text/rtf form
 at -->\n\n<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">leave approxi
 mately 2:00</FONT></SPAN><SPAN LANG="en-us"></SPAN></P>\n\n</BODY>\n</HTML
 >
X-MICROSOFT-CDO-BUSYSTATUS:FREE
X-MICROSOFT-CDO-IMPORTANCE:1
X-MICROSOFT-DISALLOW-COUNTER:FALSE
X-MS-OLK-APPTLASTSEQUENCE:0
X-MS-OLK-AUTOFILLLOCATION:TRUE
X-MS-OLK-AUTOSTARTCHECK:FALSE
X-MS-OLK-CONFTYPE:0
X-MOZ-GENERATION:132
END:VEVENT
10b14224cc commented 6 months ago

Should be fixed by #776

pbiering commented 1 month ago

please reopen if still reproducable with current version