From 9af155d40accef7aac3ffc6eb960d197798ebd1f Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Fri, 7 Aug 2026 18:47:01 -0500 Subject: fix: correct inverted media guard in sendMedia MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sendMedia returned when the assembled URL was non-empty — i.e. for every deviation that actually has media — so the random-media endpoint served an empty body and never sent the image. For a media-less deviation it instead fell through to mediaURL[21:] on an empty string, panicking in proxy mode. Guard on len == 0 so real media is sent and absent media is a no-op. --- app/api.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/api.go') diff --git a/app/api.go b/app/api.go index 5b23668..c89f10d 100755 --- a/app/api.go +++ b/app/api.go @@ -46,7 +46,7 @@ func (a API) Error(description string, status int) { func (a API) sendMedia(d *devianter.Deviation) { mediaURL, name := devianter.UrlFromMedia(d.Media) a.main.SetFilename(name) - if len(mediaURL) != 0 { + if len(mediaURL) == 0 { return } -- cgit v1.2.3