dolanor/caldav-go

SOGO

n3aka opened this issue · 4 comments

n3aka commented

v0.2.0

Hi, I'm trying to get the caldav events from my server, and after uncommenting the log in the Decode function I got a bit more to report. Still I'm fairly new and am not entirely sure what's going on.

That's the code from the example

   server, err := caldav.NewServer("https://username:password@mail.hostname/SOGo/dav/davusername/Calendar/")

   client := caldav.NewClient(server, http.DefaultClient)

   ft, err := client.GetEvents("/personal.ics")
.......
BEGIN:VTODO
DTSTAMP:20201212T152404Z
UID:b0b175bd-81b6-4a70-ba23-63dee4f1232f
SEQUENCE:2
CREATED:20201129T143524Z
LAST-MODIFIED:20201212T145458Z
SUMMARY:Digitec Bill
CLASS:PUBLIC
STATUS:COMPLETED
DUE;TZID=Europe/Zurich:20201201T130001
COMPLETED:20201212T145356Z
PERCENT-COMPLETE:100
END:VTODO
X-WR-CALNAME:Personal Calendar
END:VCALENDAR
panic: reflect: call of reflect.Append on ptr Value

goroutine 1 [running]:
reflect.flag.mustBe(...)
        /usr/lib/go/src/reflect/value.go:221
reflect.Append(0x6d7b20, 0xc0005699c0, 0x196, 0xc0005b9490, 0x1, 0x1, 0x0, 0x0, 0x0)
        /usr/lib/go/src/reflect/value.go:2044 +0x205
github.com/dolanor/caldav-go/icalendar.hydrateProperty(0x6d7b20, 0xc0005699c0, 0x196, 0xc0000cdfc0, 0xc000180fe0, 0xc000569901)
        /home/x/go/pkg/mod/github.com/dolanor/caldav-go@v0.2.0/icalendar/unmarshal.go:200 +0x29e
github.com/dolanor/caldav-go/icalendar.hydrateProperties(0x6ed8c0, 0xc0005698c0, 0x16, 0xc000782160, 0x6, 0x0)
        /home/x/go/pkg/mod/github.com/dolanor/caldav-go@v0.2.0/icalendar/unmarshal.go:270 +0x3e5
github.com/dolanor/caldav-go/icalendar.hydrateComponent(0x6ed8c0, 0xc0005698c0, 0x16, 0xc000782160, 0xc0005698c0, 0x16)
        /home/x/go/pkg/mod/github.com/dolanor/caldav-go@v0.2.0/icalendar/unmarshal.go:302 +0x26d
github.com/dolanor/caldav-go/icalendar.hydrateNestedComponent(0x6bf7a0, 0xc00015e1e8, 0x197, 0xc000782160, 0x0, 0x0)
        /home/x/go/pkg/mod/github.com/dolanor/caldav-go@v0.2.0/icalendar/unmarshal.go:224 +0xd6
github.com/dolanor/caldav-go/icalendar.hydrateProperties(0x6e5a00, 0xc00015e180, 0x16, 0xc00025c2a0, 0x9, 0x0)
        /home/x/go/pkg/mod/github.com/dolanor/caldav-go@v0.2.0/icalendar/unmarshal.go:284 +0x751
github.com/dolanor/caldav-go/icalendar.hydrateComponent(0x6e5a00, 0xc00015e180, 0x16, 0xc00025c2a0, 0xc00055e768, 0x1)
        /home/x/go/pkg/mod/github.com/dolanor/caldav-go@v0.2.0/icalendar/unmarshal.go:302 +0x26d
github.com/dolanor/caldav-go/icalendar.hydrateValue(0x6e5a00, 0xc00015e180, 0x16, 0xc00025c1c0, 0x0, 0xc00015bd38)
        /home/x/go/pkg/mod/github.com/dolanor/caldav-go@v0.2.0/icalendar/unmarshal.go:353 +0xbf2
github.com/dolanor/caldav-go/icalendar.Unmarshal(0xc000484000, 0x15a95, 0x6e5a00, 0xc00015e180, 0x15a95, 0x1fe00)
        /home/x/go/pkg/mod/github.com/dolanor/caldav-go@v0.2.0/icalendar/unmarshal.go:363 +0xdc
github.com/dolanor/caldav-go/caldav.(*Response).Decode(0xc0000ca000, 0x6e5a00, 0xc00015e180, 0x0, 0x0)
        /home/x/go/pkg/mod/github.com/dolanor/caldav-go@v0.2.0/caldav/response.go:31 +0x331
github.com/dolanor/caldav-go/caldav.(*Client).GetEvents(0xc00000eda0, 0x7247b0, 0xd, 0x0, 0x0, 0xc00015bf48, 0x6a0913, 0xc00015bf38)
        /home/x/go/pkg/mod/github.com/dolanor/caldav-go@v0.2.0/caldav/client.go:130 +0x4e7
main.main()
        /home/x/projects/echo-gorm-example/main.go:30 +0xb5
exit status 2


**When I call the Features Function that's the response**,
[calendar-access calendar-schedule calendar-auto-schedule calendar-proxy calendar-query-extended]

Hi,

I'm sorry, I just saw this bug report.
I will try to reproduce with a SOGo installation. I'll see that this week-end, or later next week.

Ok, the API documentation is not clear about it. I had to try myself to get it.
In the caldav.NewServer(), you put the host only, no path after.

And in the client, you use the full path, starting from the web root:

server, err := caldav.NewServer("https://username:password@mail.hostname/")
client := caldav.NewClient(server, http.DefaultClient)
ft, err := client.GetEvents("/SOGo/dav/davusername/Calendar/personal.ics")

I updated the documentation and naming.

n3aka commented

Thank you very much!

Did you try it, and did it fix it for you as well?