Skip to content

Commit

Permalink
Protect against missing references
Browse files Browse the repository at this point in the history
  • Loading branch information
dhh committed May 18, 2024
1 parent 8dcae22 commit 47951bb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/propshaft/compiler/css_asset_urls.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def referenced_by(asset, references: Set.new)
asset.content.scan(ASSET_URL_PATTERN).each do |referenced_asset_url, _|
referenced_asset = load_path.find(resolve_path(asset.logical_path.dirname, referenced_asset_url))

unless references.include?(referenced_asset)
if referenced_asset && references.exclude?(referenced_asset)
references << referenced_asset
references.merge referenced_by(referenced_asset, references: references)
end
Expand Down
3 changes: 2 additions & 1 deletion test/fixtures/assets/first_path/dependent/b.css
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
@import url('c.css')
@import url('c.css')
@import url('missing.css')

0 comments on commit 47951bb

Please sign in to comment.