From 3c2c40e1c8eb0800ea1ca0f5edf4d697f13020b7 Mon Sep 17 00:00:00 2001 From: revelaction <96388231+revelaction@users.noreply.github.com> Date: Sat, 5 Oct 2024 17:21:55 +0200 Subject: [PATCH] fix: correct image name assignment and update test data --- ical/parse.go | 6 +++--- ical/parse_test.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ical/parse.go b/ical/parse.go index 935fd7f..f123949 100644 --- a/ical/parse.go +++ b/ical/parse.go @@ -199,20 +199,20 @@ func (p *Parser) buildNotificationImage(n notify.Notification, event *ics.VEvent n.ImageName = image.Name } else if image.Type == config.ImageTypeBase64 { n.ImageData = image.Data - n.ImageName = "image12.jpg" + n.ImageName = image.Name } } else { // TODO move validation from config data, err := config.DecodeBase64URI(imageUrlProp.Value) if err == nil { n.ImageData = data - n.ImageName = "image12.jpg" + n.ImageName = "" } else { err := config.ValidateUrl(imageUrlProp.Value) if err == nil { if seemsImageFile(imageUrlProp.Value) { n.ImageUrl = imageUrlProp.Value - n.ImageName = imageUrlProp.Value + n.ImageName = "" } } } diff --git a/ical/parse_test.go b/ical/parse_test.go index 71d33e5..296a39b 100644 --- a/ical/parse_test.go +++ b/ical/parse_test.go @@ -563,7 +563,7 @@ DTEND;TZID=Europe/Berlin:20231226T160000 RRULE:FREQ=DAILY SUMMARY:Event with Base64 Image DESCRIPTION:Event with a base64 encoded image -ATTACH:data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg== +ATTACH;ENCODING=BASE64;FMTTYPE=image/jpeg:iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg== END:VEVENT END:VCALENDAR `)