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:
parent
e5bf6d6ba1
commit
067cee2d41
1 changed files with 4 additions and 1 deletions
|
@ -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}"
|
||||||
|
|
Loading…
Reference in a new issue