From 0c01506152d7ee324987fc64eeb28911e6ca170d Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Fri, 5 Nov 2021 16:22:37 +0100 Subject: [PATCH] Fix: Work around Discord screwing up image URLs Signed-off-by: Knut Ahlers --- mod_livePosting.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mod_livePosting.go b/mod_livePosting.go index e387a98..1973cc3 100644 --- a/mod_livePosting.go +++ b/mod_livePosting.go @@ -2,6 +2,7 @@ package main import ( "context" + "encoding/base64" "net/url" "strconv" "strings" @@ -274,7 +275,8 @@ func (m *modLivePosting) sendLivePost(username, displayName, title, game, previe // @attr preserve_proxy optional string "" URL prefix of a Luzifer/preserve proxy to cache stream preview for longer if proxy, err := url.Parse(m.attrs.MustString("preserve_proxy", ptrStringEmpty)); err == nil && proxy.String() != "" { - proxy.Path = "/" + previewImageURL.String() + // Discord screws up the plain-text URL format, so we need to use the b64-format + proxy.Path = "/b64:" + base64.URLEncoding.EncodeToString([]byte(previewImageURL.String())) previewImageURL = proxy }