fix caldav descriptions
All checks were successful
continuous-integration/drone/pr Build is passing

This commit is contained in:
Martin Giger 2020-10-21 21:56:49 +02:00
parent 0e3a6cd673
commit 319cdbfc87
Signed by untrusted user: freaktechnik
GPG Key ID: AE530058EFE7FD60

View File

@ -18,6 +18,7 @@ package caldav
import (
"fmt"
"regexp"
"strconv"
"strings"
"time"
@ -92,11 +93,17 @@ PRODID:-//` + config.ProdID + `//EN`
e.UID = makeCalDavTimeFromTimeStamp(e.Timestamp) + utils.Sha256(e.Summary)
}
formattedDescription := ""
if e.Description != "" {
re := regexp.MustCompile(`\r?\n`)
formattedDescription = re.ReplaceAllString(e.Description, "\\n")
}
caldavevents += `
BEGIN:VEVENT
UID:` + e.UID + `
SUMMARY:` + e.Summary + `
DESCRIPTION:` + e.Description + `
DESCRIPTION:` + formattedDescription + `
DTSTAMP:` + makeCalDavTimeFromTimeStamp(e.Timestamp) + `
DTSTART:` + makeCalDavTimeFromTimeStamp(e.Start) + `
DTEND:` + makeCalDavTimeFromTimeStamp(e.End)
@ -152,8 +159,10 @@ DTSTART: ` + makeCalDavTimeFromTimeStamp(t.Start)
DTEND: ` + makeCalDavTimeFromTimeStamp(t.End)
}
if t.Description != "" {
re := regexp.MustCompile(`\r?\n`)
formattedDescription := re.ReplaceAllString(t.Description, "\\n")
caldavtodos += `
DESCRIPTION:` + t.Description
DESCRIPTION:` + formattedDescription
}
if t.Completed.Unix() > 0 {
caldavtodos += `