aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/caldav/routes.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/caldav/routes.go')
-rw-r--r--plugins/caldav/routes.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/plugins/caldav/routes.go b/plugins/caldav/routes.go
index 52f8d31..4610330 100644
--- a/plugins/caldav/routes.go
+++ b/plugins/caldav/routes.go
@@ -2,9 +2,11 @@ package alpscaldav
import (
"fmt"
+ "log"
"net/http"
"net/url"
"path"
+ "strings"
"time"
"git.sr.ht/~emersion/alps"
@@ -179,6 +181,8 @@ func registerRoutes(p *alps.GoPlugin, u *url.URL) {
if ctx.Request().Method == "POST" {
summary := ctx.FormValue("summary")
+ description := ctx.FormValue("description")
+
start, err := time.Parse("2006-01-02", ctx.FormValue("start"))
if err != nil {
err = fmt.Errorf("malformed start date: %v", err)
@@ -203,6 +207,13 @@ func registerRoutes(p *alps.GoPlugin, u *url.URL) {
event.Props.SetDateTime(ical.PropDateTimeEnd, end)
event.Props.Del(ical.PropDuration)
+ if description != "" {
+ description = strings.ReplaceAll(description, "\r", "")
+ event.Props.SetText(ical.PropDescription, description)
+ } else {
+ event.Props.Del(ical.PropDescription)
+ }
+
newID := uuid.New()
if prop := event.Props.Get(ical.PropUID); prop == nil {
event.Props.SetText(ical.PropUID, newID.String())