Use new ical library

This commit is contained in:
Simon Ser 2020-02-24 17:52:25 +01:00
parent 7d2b6a3902
commit 07d4dfae5e
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48
4 changed files with 7 additions and 12 deletions

View File

@ -6,7 +6,7 @@ package caldav
import ( import (
"time" "time"
"github.com/luxifer/ical" "github.com/emersion/go-ical"
) )
type Calendar struct { type Calendar struct {

View File

@ -5,9 +5,9 @@ import (
"fmt" "fmt"
"time" "time"
"github.com/emersion/go-ical"
"github.com/emersion/go-webdav" "github.com/emersion/go-webdav"
"github.com/emersion/go-webdav/internal" "github.com/emersion/go-webdav/internal"
"github.com/luxifer/ical"
) )
// Client provides access to a remote CardDAV server. // Client provides access to a remote CardDAV server.
@ -174,13 +174,8 @@ func decodeCalendarObjectList(ms *internal.Multistatus) ([]CalendarObject, error
return nil, err return nil, err
} }
// Normalize line endings r := bytes.NewReader(calData.Data)
// TODO: make the ical package less strict data, err := ical.NewDecoder(r).DecodeCalendar()
b := calData.Data
b = bytes.ReplaceAll(b, []byte{'\r', '\n'}, []byte{'\n'})
b = bytes.ReplaceAll(b, []byte{'\n'}, []byte{'\r', '\n'})
data, err := ical.Parse(bytes.NewReader(b), nil)
if err != nil { if err != nil {
return nil, err return nil, err
} }

2
go.mod
View File

@ -3,6 +3,6 @@ module github.com/emersion/go-webdav
go 1.13 go 1.13
require ( require (
github.com/emersion/go-ical v0.0.0-20200224161826-aa4584e92c62
github.com/emersion/go-vcard v0.0.0-20191221110513-5f81fa0d3cc7 github.com/emersion/go-vcard v0.0.0-20191221110513-5f81fa0d3cc7
github.com/luxifer/ical v0.0.0-20191105105432-84b768eb6395
) )

4
go.sum
View File

@ -1,4 +1,4 @@
github.com/emersion/go-ical v0.0.0-20200224161826-aa4584e92c62 h1:kP9BxopsBc1jfYfHgbgnDBJeCfZt9GkyWXFmNOcRsps=
github.com/emersion/go-ical v0.0.0-20200224161826-aa4584e92c62/go.mod h1:4xVTBPcT43a1pp3vdaa+FuRdX5XhKCZPpWv7m0z9ByM=
github.com/emersion/go-vcard v0.0.0-20191221110513-5f81fa0d3cc7 h1:SE+tcd+0kn0cT4MqTo66gmkjqWHF1Z+Yha5/rhLs/H8= github.com/emersion/go-vcard v0.0.0-20191221110513-5f81fa0d3cc7 h1:SE+tcd+0kn0cT4MqTo66gmkjqWHF1Z+Yha5/rhLs/H8=
github.com/emersion/go-vcard v0.0.0-20191221110513-5f81fa0d3cc7/go.mod h1:HMJKR5wlh/ziNp+sHEDV2ltblO4JD2+IdDOWtGcQBTM= github.com/emersion/go-vcard v0.0.0-20191221110513-5f81fa0d3cc7/go.mod h1:HMJKR5wlh/ziNp+sHEDV2ltblO4JD2+IdDOWtGcQBTM=
github.com/luxifer/ical v0.0.0-20191105105432-84b768eb6395 h1:H7Rbug09BDCzr6k/PASDjSMjbJGzXswwqesaDiBNJz8=
github.com/luxifer/ical v0.0.0-20191105105432-84b768eb6395/go.mod h1:TGCe94U3u9fXQl4yHJ8W87z1czj057aVLxYnFYTDC08=