Stop returning GIF URLs from _best_portrait_url
All checks were successful
Build plugin / build (push) Successful in 1m11s

When all available cover URLs are GIFs (coverUrl, stillCoverUrl, and
screenshots), return empty instead of a GIF URL. HTTPImageFetcher cannot
decode GIFs, so attempting to fetch one always returns null. Returning
empty early avoids unnecessary network requests and confusing log noise.
This commit is contained in:
Jose Falanga 2026-08-19 18:29:34 -03:00
parent 696123b55a
commit 658e8552cb
2 changed files with 7 additions and 4 deletions

View file

@ -174,6 +174,7 @@ func _url_for_layout(kind: LAYOUT, cover_url: String, screenshots: Array) -> Str
for url in screenshots:
if not _is_gif_url(url):
return url
# cover_url is already sanitized and non-GIF by the time it reaches here
return cover_url
LAYOUT.BANNER:
# Single screenshot fallback (two-screenshot case handled in get_boxart).
@ -187,7 +188,8 @@ func _url_for_layout(kind: LAYOUT, cover_url: String, screenshots: Array) -> Str
## Returns a non-GIF URL suitable for portrait/logo from the game data.
## Falls back through: stillCoverUrl → coverUrl (non-GIF) → first non-GIF
## screenshot.
## 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
var still: String = game.get("stillCoverUrl", "")
@ -201,8 +203,9 @@ func _best_portrait_url(game: Dictionary, screenshots: Array) -> String:
for url in screenshots:
if not _is_gif_url(url):
return url
# Last resort: use whatever we have (GIF)
return still if not still.is_empty() else cover
# All available URLs are GIFs — return empty so the caller gets null
# instead of attempting a doomed fetch.
return ""
## Combines two textures side-by-side into a single banner image.