From bb890228402426da7a56f89df4933a2754eef962 Mon Sep 17 00:00:00 2001 From: sebm253 <42180891+sebm253@users.noreply.github.com> Date: Sat, 21 Sep 2024 20:21:37 +0200 Subject: [PATCH] Only append period with extension to proper routes --- discord/cdn_endpoints.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/discord/cdn_endpoints.go b/discord/cdn_endpoints.go index e9a064ca..88ca24aa 100644 --- a/discord/cdn_endpoints.go +++ b/discord/cdn_endpoints.go @@ -94,12 +94,17 @@ func (e CDNEndpoint) URL(format FileFormat, values QueryValues, params ...any) s query = "?" + query } - // for some reason custom gif stickers use a different cnd url, blame discord for this one + // for some reason custom gif stickers use a different cdn url, blame discord for this one if format == FileFormatGIF && e.Route == "/stickers/{sticker.id}" { return urlPrint(CDNMedia+e.Route+"."+format.String(), params...) + query } + route := CDN + e.Route + // only append period and file extension if the format is not FileFormatNone + if format != FileFormatNone { + route += "." + format.String() + } - return urlPrint(CDN+e.Route+"."+format.String(), params...) + query + return urlPrint(route, params...) + query } func DefaultCDNConfig(format FileFormat) *CDNConfig {