Skip to content

ImageKeys: Fix image loading for sets with modern folder names#9429

Open
Dragynrain wants to merge 4 commits intoCard-Forge:masterfrom
Dragynrain:fix/image-lookup-modern-set-codes
Open

ImageKeys: Fix image loading for sets with modern folder names#9429
Dragynrain wants to merge 4 commits intoCard-Forge:masterfrom
Dragynrain:fix/image-lookup-modern-set-codes

Conversation

@Dragynrain
Copy link
Contributor

Summary

When images are downloaded via Scryfall, they are stored in folders using modern set codes (e.g., DST for Darksteel). However, the image lookup system only checked legacy Code2 folders (e.g., DS), causing images to not load on first access in Adventure mode shops.

This fix extends hasImage() to check multiple folder locations:

  1. Legacy Code2 folder (e.g., DS/) - checked first, wins for duplicates
  2. Modern code folder (e.g., DST/)
  3. Alias folder (if defined)

The fix also handles mixed setups where images may be split across multiple folders, merging contents into the cache while preserving priority for existing legacy folder images.

Fixes #9408

Test Plan

  • Tested with only modern code folders (DST/) - images load on first shop visit
  • Tested with symlinks from legacy to modern folders - still works
  • Tested ~15 Adventure mode shops with older sets - all loaded correctly

Dragynrain and others added 4 commits January 6, 2026 12:33
When images are downloaded via Scryfall, they are stored in folders using
modern set codes (e.g., DST for Darksteel). However, the image lookup
system only checked legacy Code2 folders (e.g., DS), causing images to
not load on first access in Adventure mode shops.

This fix extends hasImage() to check multiple folder locations:
1. Legacy Code2 folder (e.g., DS/) - checked first, wins for duplicates
2. Modern code folder (e.g., DST/)
3. Alias folder (if defined)

The fix also handles mixed setups where images may be split across
multiple folders, merging contents into the cache while preserving
priority for existing legacy folder images.

Fixes Card-Forge#9408
@Dragynrain
Copy link
Contributor Author

Anything I can do to get this moving along?

@Jetz72 Jetz72 requested a review from Hanmac February 4, 2026 16:34
@Jetz72 Jetz72 added the Images label Feb 4, 2026
@Hanmac
Copy link
Contributor

Hanmac commented Feb 4, 2026

I don't really like adding more fallbacks

I would prefer to clean up with a more cleaner design (see my other issues)

@Jetz72
Copy link
Contributor

Jetz72 commented Feb 4, 2026

I think supporting fallback paths for the game's resources makes sense regardless of how it's organized later. If we change the storage location for images at a later date, we'd want a fallback regardless so that we don't force every user to redownload all their card images. Some users have countless images accumulated over time, others manually install hi-res image packs, others still use custom card images to reskin their cards. At minimum it'd be good to have fallback support, and ideally we'd want fallback support that migrates files to the new storage location automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adventure mode shops fail to load card images on first visit for sets with legacy Code2 values

3 participants