Fix srcset-polluted URLs from butlerd, sanitize cover and screenshot URLs
All checks were successful
Build plugin / build (push) Successful in 1m13s

butlerd sometimes passes itch.io coverUrl/stillCoverUrl with trailing
srcset descriptors (e.g. ' 1x, h' or ' 1'). These polluted URLs cause
HTTPImageFetcher to fail because the URL is invalid and the extension
extraction breaks.

Changes:
- Add _sanitize_url() to strip srcset artifacts from URLs
- Add _is_gif_url() helper that works with both clean and polluted URLs
- Fix SCREENSHOT_REGEX_PATTERN to use [\w+/=]* instead of [^"]* to
  avoid crossing srcset boundaries in HTML
- Replace all .ends_with('.gif') checks with _is_gif_url()
- Sanitize all URLs from game metadata and HTML scraping
- Add IMAGE_EXTS constant for extension validation

Also bump to v0.1.7.
This commit is contained in:
Jose Falanga 2026-08-19 18:08:35 -03:00
parent 730b600ec0
commit 1bde072983
2 changed files with 34 additions and 12 deletions

View file

@ -1,7 +1,7 @@
{
"plugin.id": "itch-artprovider",
"plugin.name": "itch.io Art Provider",
"plugin.version": "0.1.6",
"plugin.version": "0.1.7",
"plugin.min-api-version": "1.1.0",
"plugin.link": "https://forge.thergic.ar/jose/itchio-opengamepadui-artprovider-plugin",
"plugin.source": "https://forge.thergic.ar/jose/itchio-opengamepadui-artprovider-plugin",