mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 20:27:28 +08:00
FIX: don't crash out searching for parent in oneboxer
This commit is contained in:
parent
9cad925c67
commit
18a8853181
|
@ -82,13 +82,14 @@ module Oneboxer
|
|||
changed = false
|
||||
|
||||
Oneboxer.each_onebox_link(doc) do |url, element|
|
||||
onebox, preview = yield(url,element)
|
||||
onebox, _preview = yield(url,element)
|
||||
if onebox
|
||||
parsed_onebox = Nokogiri::HTML::fragment(onebox)
|
||||
next unless parsed_onebox.children.count > 0
|
||||
|
||||
# special logic to strip empty p elements
|
||||
if element.parent &&
|
||||
element.parent.node_name &&
|
||||
element.parent.node_name.downcase == "p" &&
|
||||
element.parent.children.count == 1
|
||||
element = element.parent
|
||||
|
|
Loading…
Reference in New Issue
Block a user