From cf6921329dc4368abb33d487cb7c2e3ac234113a Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Thu, 7 Mar 2024 14:16:05 -0800 Subject: [PATCH] Oops, choose the *first* PNG from the manifest, to avoid reference art When we moved more logic into the main app, we made some assumptions about manifest art that were different than Impress 2020's, in hopes that they would be More Correct for potential future edge cases. Turns out, they were actually *less* correct for *current* edge cases! Chips linked us to a few examples, including this Reddit post: https://www.reddit.com/r/neopets/comments/1b8fd72/i_dont_think_thats_the_correct_image/ Fixed now! --- app/models/swf_asset.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/models/swf_asset.rb b/app/models/swf_asset.rb index c886eabd..d2503b55 100644 --- a/app/models/swf_asset.rb +++ b/app/models/swf_asset.rb @@ -131,13 +131,13 @@ class SwfAsset < ApplicationRecord # seen! { js: assets_by_ext[:js].last } else - # Otherwise, return the last PNG and the last SVG, arbitrarily. - # (There's probably only one of each! I'm just going by the same logic - # we've seen in the JS library case, that later entries are more likely - # to be correct.) + # Otherwise, return the first PNG and the first SVG. (Unlike the JS + # case, it's important to choose the *first* PNG, because sometimes + # reference art is included in the manifest, like with the Stealthy + # Eyrie Shirt's asset 304486_b28cae0d76.) { - png: assets_by_ext.fetch(:png, []).last, - svg: assets_by_ext.fetch(:svg, []).last, + png: assets_by_ext.fetch(:png, []).first, + svg: assets_by_ext.fetch(:svg, []).first, } end rescue StandardError => error