Oops, fix bug reading manifest assets when .svg is not present

Ah right, I make this mistake a lot when doing `group_by` stuff: if
there's no SVG, then `assets_by_ext[:svg]` is `nil`, not `[]`. Oh well!
This commit is contained in:
Emi Matchu 2024-02-25 15:02:35 -08:00
parent e5bf6d6ba1
commit 067cee2d41

View file

@ -88,7 +88,10 @@ class SwfAsset < ApplicationRecord
# (There's probably only one of each! I'm just going by the same logic # (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 # we've seen in the JS library case, that later entries are more likely
# to be correct.) # to be correct.)
{ png: assets_by_ext[:png].last, svg: assets_by_ext[:svg].last } {
png: assets_by_ext.fetch(:png, []).last,
svg: assets_by_ext.fetch(:svg, []).last,
}
end end
rescue StandardError => error rescue StandardError => error
Rails.logger.error "Could not read URLs from manifest: #{error.full_message}" Rails.logger.error "Could not read URLs from manifest: #{error.full_message}"