Skip to content

Commit

Permalink
fix: correct image name assignment and update test data
Browse files Browse the repository at this point in the history
  • Loading branch information
revelaction committed Oct 5, 2024
1 parent 4f1f117 commit 3c2c40e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions ical/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion ical/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
`)
Expand Down

0 comments on commit 3c2c40e

Please sign in to comment.