mirror of
https://github.com/aljazceru/njump.git
synced 2025-12-17 06:14:22 +01:00
shorten URLs when rendering text image so they don't use all the space.
This commit is contained in:
@@ -52,6 +52,7 @@ func renderImage(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
content := strings.Replace(data.event.Content, "\n\n\n\n", "\n\n", -1)
|
||||
content = strings.Replace(data.event.Content, "\n\n\n", "\n\n", -1)
|
||||
content = shortenURLs(content)
|
||||
|
||||
// this turns the raw event.Content into a series of lines ready to drawn
|
||||
paragraphs := replaceUserReferencesWithNames(r.Context(),
|
||||
@@ -72,7 +73,6 @@ func renderImage(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
if err := png.Encode(w, img); err != nil {
|
||||
log.Printf("error encoding image: %s", err)
|
||||
http.Error(w, "error encoding image!", 500)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user