From c811aedb14c19692ebf5c51c931cdbf7dc9ac811 Mon Sep 17 00:00:00 2001 From: Bassel Al Sheikh Ali Date: Sun, 29 Dec 2024 18:18:13 +0300 Subject: [PATCH] fix: add Arabic font support and SVG upload --- app/handlers/images.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/handlers/images.go b/app/handlers/images.go index 089c17e75..63e7a9d45 100644 --- a/app/handlers/images.go +++ b/app/handlers/images.go @@ -135,10 +135,17 @@ func Gravatar() web.HandlerFunc { name = "?" } - // Extract and draw letter avatar - extractedLetter := letteravatar.Extract(name) + // URL decode the name (matching LetterAvatar behavior) + decodedName, err := url.QueryUnescape(name) + if err != nil { + log.Error(c, err) + return c.Failure(err) + } + + // Use the same mechanism as LetterAvatar + extractedLetter := letteravatar.Extract(decodedName) img, err := letteravatar.Draw(size, extractedLetter, &letteravatar.Options{ - PaletteKey: fmt.Sprintf("%d:%s", id, name), + PaletteKey: fmt.Sprintf("%s:%s", fmt.Sprint(id), decodedName), }) if err != nil { log.Error(c, err)