mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
FIX: PullHotlinkedImages was messing with URL when using Markdown references
This commit is contained in:
parent
1ac0c97c81
commit
78de89f7a1
1 changed files with 2 additions and 2 deletions
|
@ -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 a new issue