mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 19:30:42 +08:00
FIX: PullHotlinkedImages was messing with URL when using Markdown references
This commit is contained in:
parent
1ac0c97c81
commit
78de89f7a1
|
@ -61,9 +61,9 @@ module Jobs
|
|||
# Markdown inline - ![alt](http://...)
|
||||
raw.gsub!(/!\[([^\]]*)\]\(#{escaped_src}\)/) { "![#{$1}](#{url})" }
|
||||
# Markdown reference - [x]: http://
|
||||
raw.gsub!(/\[(\d+)\]: #{escaped_src}/) { "[#{$1}]: #{url}" }
|
||||
raw.gsub!(/\[([^\]]+)\]:\s?#{escaped_src}/) { "[#{$1}]: #{url}" }
|
||||
# Direct link
|
||||
raw.gsub!(src, "<img src='#{url}'>")
|
||||
raw.gsub!(/^#{escaped_src}\s?$/, "<img src='#{url}'>")
|
||||
end
|
||||
rescue => e
|
||||
Rails.logger.info("Failed to pull hotlinked image: #{src} post:#{post_id}\n" + e.message + "\n" + e.backtrace.join("\n"))
|
||||
|
|
Loading…
Reference in New Issue
Block a user