Skip to content

Commit 5869d3d

Browse files
committed
Fix bug loading a default script tag if a profile tag is missing.
1 parent 4d72cef commit 5869d3d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/json/ld/api.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ def self.load_html(input, url:,
739739
elements = if profile
740740
es = input.xpath("//script[starts-with(@type, 'application/ld+json;profile=#{profile}')]")
741741
# If no profile script, just take a single script without profile
742-
es = [input.at_xpath("//script[starts-with(@type, 'application/ld+json')]")] if es.empty?
742+
es = [input.at_xpath("//script[starts-with(@type, 'application/ld+json')]")].compact if es.empty?
743743
es
744744
else
745745
input.xpath("//script[starts-with(@type, 'application/ld+json')]")

0 commit comments

Comments
 (0)