fix: don't fall back to screenshots as capsule art
All checks were successful
Build plugin / build (push) Successful in 1m10s

_best_portrait_url was falling back to non-GIF screenshots when both
coverUrl and stillCoverUrl were GIFs. Screenshots are not capsule art,
so this produced wrong imagery. Now the function only returns cover
URLs and returns empty when only GIFs are available.
This commit is contained in:
Jose Falanga 2026-08-19 18:49:29 -03:00
parent 658e8552cb
commit 98053e6ea7
2 changed files with 6 additions and 14 deletions

View file

@ -186,25 +186,17 @@ func _url_for_layout(kind: LAYOUT, cover_url: String, screenshots: Array) -> Str
return ""
## Returns a non-GIF URL suitable for portrait/logo from the game data.
## Falls back through: stillCoverUrl → coverUrl (non-GIF) → first non-GIF
## screenshot. Returns empty if only GIFs are available, since
## HTTPImageFetcher cannot decode GIF images.
func _best_portrait_url(game: Dictionary, screenshots: Array) -> String:
# Prefer stillCoverUrl if it's not a GIF
## Returns the best portrait/logo URL from the game data.
## Prefers stillCoverUrl, then coverUrl. Screenshots are never used as
## capsule art. Returns empty if the only available cover URLs are GIFs,
## since HTTPImageFetcher cannot decode GIF images.
func _best_portrait_url(game: Dictionary, _screenshots: Array) -> String:
var still: String = game.get("stillCoverUrl", "")
if not still.is_empty() and not _is_gif_url(still):
return still
# Try coverUrl if it's not a GIF
var cover: String = game.get("coverUrl", "")
if not cover.is_empty() and not _is_gif_url(cover):
return cover
# Try the first non-GIF screenshot
for url in screenshots:
if not _is_gif_url(url):
return url
# All available URLs are GIFs — return empty so the caller gets null
# instead of attempting a doomed fetch.
return ""