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

No child nodes in DAV:prop #269

Open
rickalex21 opened this issue Mar 31, 2023 · 3 comments
Open

No child nodes in DAV:prop #269

rickalex21 opened this issue Mar 31, 2023 · 3 comments

Comments

@rickalex21
Copy link

Hello, I'm having the same problems as the others. I also tried the patch from #126 that @rgemulla
provided and was mentioned in #231.

I haven't set this up, I'm trying to sync to icloud. I can get all the calendars fine with curl
and calcurse.

Here is the xml response i get, any help would be appreciated. This is the calendar but I can
also get ics files. Curl and calcurse work fine.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<multistatus xmlns="DAV:">
  <response xmlns="DAV:">
    <href>/123456/calendars/</href>
    <propstat>
      <prop>
        <resourcetype xmlns="DAV:">
          <collection/>
        </resourcetype>
        <displayname xmlns="DAV:">My Events</displayname>
      </prop>
      <status>HTTP/1.1 200 OK</status>
    </propstat>
  </response>
....

I tried this from #126 and could not get it to work.

(defun org-caldav-url-dav-get-properties (url property)
   "Retrieve PROPERTY from URL.
  Output is the same as `url-dav-get-properties'.  This switches to
  OAuth2 if necessary."
    (let ((request-data (concat "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" "<propfind xmlns='DAV:'>\n<prop>" "<" property "/></prop></propfind>\n"))
      (extra '(("Depth" . "1") ("Content-type" . "text/xml"))))
    (let ((resultbuf (org-caldav-url-retrieve-synchronously
          url "PROPFIND" request-data extra)))
    (with-current-buffer resultbuf
      (goto-char (point-min))
      (when (not (re-search-forward "^HTTP[^ ]* \\([0-9]+ .*\\)$"
                (point-at-eol) t))
      (switch-to-buffer buffer)
      (error "No valid HTTP response from URL %s." url))
      (let ((response (match-string 1)))
      (when (not (string-match "2[0-9][0-9].*" response))
      (switch-to-buffer resultbuf)
      (error "Error while doing PROPFIND for '%s' at URL %s: %s" property url response))))
    (org-caldav-namespace-bug-workaround resultbuf)
    ;; HACK: remove DAV:responses with empty properties
    (with-current-buffer resultbuf
      (save-excursion 
      (while (re-search-forward "<response>" nil t)
      (let ((begin (point))
        (end (progn (re-search-forward "<response>" nil t) (+ (point) 0))))
        (when (and begin end)
        (goto-char begin)
        (if (and (re-search-forward "<prop/>" nil t) (< (point) end))
          (progn
          (goto-char end)
          (delete-region begin end))
        (goto-char end)))))))
        (url-dav-process-response resultbuf url))))

Thanks

@MartinNowak
Copy link

MartinNowak commented Jun 28, 2023

Ironically this happens during an unnecessary check-connection, otherwise works fine.

Here is the xml response i get, any help would be appreciated. This is the calendar but I can
also get ics files. Curl and calcurse work fine.

You seem to miss the calendar id, should be some uuid like 9FA7B7BF-BC28-4376-8351-A9A27E82C7BE.

(use-package org-caldav
  :ensure t
  :config
  (setq org-caldav-url "https://p<XX>-caldav.icloud.com/<DSid>/calendars"
        org-caldav-calendars
        '((:calendar-id "<calendar-id>"
                        :files ("~/org/cal.org")
                        :inbox "~/org/frm-cal.org"))))

You can find those e.g. via evolution or Apple's webmail.

@yaqubroli
Copy link

I'm encountering the same issue even though my calendar ID is properly configured. Any help would be appreciated.
image

@yaqubroli
Copy link

I'm encountering the same issue even though my calendar ID is properly configured. Any help would be appreciated.

Here is the xml I've got via curl. https://pastebin.com/XzWsGx4r

I don't know how events are encoded in CalDAV, but I grepped for the name of some of my test events and I couldn't find anything. It appears iCloud does something weird/doesn't cooperate, which is probably to be expected from Apple sadly

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