mirror of
https://github.com/discourse/discourse.git
synced 2025-02-07 02:02:01 +08:00
BUGFIX: proper regex escaping
This commit is contained in:
parent
2f23ee1830
commit
18489ba83a
|
@ -48,7 +48,7 @@ module Jobs
|
||||||
# have we successfully downloaded that file?
|
# have we successfully downloaded that file?
|
||||||
if downloaded_urls[src].present?
|
if downloaded_urls[src].present?
|
||||||
url = downloaded_urls[src]
|
url = downloaded_urls[src]
|
||||||
escaped_src = src.gsub("?", "\\?").gsub(".", "\\.").gsub("+", "\\+")
|
escaped_src = Regexp.escape(src)
|
||||||
# there are 6 ways to insert an image in a post
|
# there are 6 ways to insert an image in a post
|
||||||
# HTML tag - <img src="http://...">
|
# HTML tag - <img src="http://...">
|
||||||
raw.gsub!(/src=["']#{escaped_src}["']/i, "src='#{url}'")
|
raw.gsub!(/src=["']#{escaped_src}["']/i, "src='#{url}'")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user