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

org-caldav-sync fails to retrieve event from CalDAV server #45

Closed
flexibeast opened this issue Jul 1, 2014 · 3 comments
Closed

org-caldav-sync fails to retrieve event from CalDAV server #45

flexibeast opened this issue Jul 1, 2014 · 3 comments

Comments

@flexibeast
Copy link

org-caldav-sync completes with the message:

CalDAV Sync finished.

Nothing was done.

The value of the variable output in the function org-caldav-check-connection during this process is:

(("[calendar URL]" DAV:status 207 . " "))

If i do:

(let ((url-request-extra-headers '(("Depth: 1")))
      (url-request-method "PROPFIND"))
  (display-buffer (url-retrieve-synchronously (org-caldav-events-url))))

the contents of the displayed buffer are (minus HTTP headers):

<?xml version="1.0" encoding="utf-8" ?>
<multistatus xmlns="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav">
 <response>
  <href>/davical/caldav.php/alexis/calendar/</href>
  <propstat>
   <prop>
    <getcontenttype>httpd/unix-directory</getcontenttype>
    <resourcetype>
     <collection/>
     <C:calendar/>
    </resourcetype>
    <displayname>Alexis' calendar</displayname>
    <getlastmodified>Sun, 29 Jun 2014 07:22:30 GMT</getlastmodified>
    <creationdate>20140629T064258Z</creationdate>
    <getcontentlanguage/>
    <supportedlock>
     <lockentry>
      <lockscope>
       <exclusive/>
      </lockscope>
      <locktype>
       <write/>
      </locktype>
     </lockentry>
    </supportedlock>
    <owner>
     <href>/davical/caldav.php/alexis/</href>
    </owner>
    <current-user-principal>
     <href>/davical/caldav.php/alexis/</href>
    </current-user-principal>
   </prop>
   <status>HTTP/1.1 200 OK</status>
  </propstat>
 </response>
 <response>
  <href>/davical/caldav.php/alexis/calendar/dcc4493f-544c-42e9-89f7-0cfe8261c600.ics</href>
  <propstat>
   <prop>
    <getcontenttype>text/calendar</getcontenttype>
    <resourcetype/>
    <getcontentlength>755</getcontentlength>
    <displayname>Test Event</displayname>
    <getlastmodified>Sat, 28 Jun 2014 21:22:31 GMT</getlastmodified>
    <creationdate>20140628T212220Z</creationdate>
    <getetag>"33da13fe1d46db16a192e8413f2b9a89"</getetag>
    <getcontentlanguage/>
    <supportedlock>
     <lockentry>
      <lockscope>
       <exclusive/>
      </lockscope>
      <locktype>
       <write/>
      </locktype>
     </lockentry>
    </supportedlock>
    <owner>
     <href>/davical/caldav.php/alexis/</href>
    </owner>
    <current-user-principal>
     <href>/davical/caldav.php/alexis/</href>
    </current-user-principal>
   </prop>
   <status>HTTP/1.1 200 OK</status>
  </propstat>
 </response>
</multistatus>
@flexibeast
Copy link
Author

Tracing program flow, there seem to be a couple of issues occurring within url-dav-process-response in url-dav.el.

Firstly, at line 410, the value of the tree variable is:

((multistatus
  ((http://www\.w3\.org/2000/xmlns/xmlns . "DAV:"))
  (response nil
            (href nil "/davical/caldav.php/alexis/calendar/")
            (propstat nil
                      (prop nil)
                      (status nil "HTTP/1.1 200 OK"))
            (propstat nil
                      (prop nil
                            (getetag nil))
                      (status nil "HTTP/1.1 404 Not Found")))
  (response nil
            (href nil "/davical/caldav.php/alexis/calendar/2dbb681d-82f4-414f-b2f4-743e8fd5cd85.ics")
            (propstat nil
                      (prop nil
                            (getetag nil "\"e0c296d8e44561dd17c3e90229ff0cf6\""))
                      (status nil "HTTP/1.1 200 OK")))))

so that the eq fails: the code is wanting an element named 'DAV:multistatus', but (xml-node-name (car tree)) evaluates to simply 'multistatus'.

(NB. the values of href and getetag have changed from my OP as i've been deleting events and creating new ones.)

However, if we then change line 410 to:

(if (eq (xml-node-name (car tree)) 'multistatus)

execution then flows through to the line:

(url-dav-dispatch-node (car tree))

which returns the value " " (i.e. a single whitespace character). i assume this shouldn't be the case?

@novahahn
Copy link
Contributor

novahahn commented Jan 2, 2015

I have the same issue with radicale 0.9. Instead of changing line 410 I used the following hack (also includes a workaround for issue #56:

(defun my-org-caldav-advice (orig-fun &rest args)
    (let ((xml-default-ns-bak xml-default-ns)
          (org-version-bak org-version))
      (setq xml-default-ns '(("" . "DAV:")))
      (setq org-version "8.2.7")
      (apply orig-fun args)
      (setq xml-default-ns xml-default-ns-bak)
      (setq org-version org-version-bak)))
  (advice-add 'org-caldav-sync :around #'my-org-caldav-advice)

org-caldav seems to work correctly after this.

@dengste
Copy link
Owner

dengste commented May 20, 2017

This is probably the same as issue #86 and should be fixed in the latest Emacs snapshot (meaning the upcoming Emacs 26, not the current 25.x).

@dengste dengste closed this as completed May 20, 2017
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

3 participants