mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 20:36:39 +08:00
Revert "DEV: Add logging for stack level too deep exception in HtmlToMarkdown"
We can do this in a better way by storing an IncomingEmail record.
Follow-up-to: 4a9ee25c56
This commit is contained in:
parent
32ee9fae40
commit
3b368a48d1
|
@ -6,30 +6,21 @@ require "securerandom"
|
|||
class HtmlToMarkdown
|
||||
|
||||
def initialize(html, opts = {})
|
||||
@html = html
|
||||
@opts = opts
|
||||
|
||||
# we're only interested in <body>
|
||||
@doc = Nokogiri::HTML5(html).at("body")
|
||||
end
|
||||
|
||||
def to_markdown
|
||||
remove_not_allowed!(@doc)
|
||||
remove_hidden!(@doc)
|
||||
hoist_line_breaks!(@doc)
|
||||
remove_whitespaces!(@doc)
|
||||
end
|
||||
|
||||
def to_markdown
|
||||
traverse(@doc)
|
||||
.gsub(/\n{2,}/, "\n\n")
|
||||
.strip
|
||||
rescue SystemStackError => e
|
||||
Discourse.warn_exception(
|
||||
e,
|
||||
message: "stack level too deep in HtmlToMarkdown",
|
||||
env: { html: @html },
|
||||
)
|
||||
|
||||
raise
|
||||
end
|
||||
|
||||
private
|
||||
|
|
Loading…
Reference in New Issue
Block a user