Skip to content

Commit a4bc898

Browse files
committed
Limits the schemes that inline images can use (#22926).
git-svn-id: http://svn.redmine.org/redmine/trunk@15433 e93f8b46-1217-0410-a6f0-8f06a7374b81
1 parent 1be5354 commit a4bc898

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

lib/redcloth3.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@
165165
# class RedCloth::Textile.new( str )
166166

167167
class RedCloth3 < String
168+
include Redmine::Helpers::URL
168169

169170
VERSION = '3.0.4'
170171
DEFAULT_RULES = [:textile, :markdown]
@@ -960,6 +961,8 @@ def inline_textile_image( text )
960961
href, alt_title = check_refs( href ) if href
961962
url, url_title = check_refs( url )
962963

964+
return m unless uri_with_safe_scheme?(url)
965+
963966
out = ''
964967
out << "<a#{ shelve( " href=\"#{ href }\"" ) }>" if href
965968
out << "<img#{ shelve( atts ) } />"

lib/redmine/wiki_formatting/markdown/formatter.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ def block_code(code, language)
4343
"<pre>" + CGI.escapeHTML(code) + "</pre>"
4444
end
4545
end
46+
47+
def image(link, title, alt_text)
48+
return unless uri_with_safe_scheme?(link)
49+
50+
tag('img', :src => link, :alt => alt_text || "", :title => title)
51+
end
4652
end
4753

4854
class Formatter

0 commit comments

Comments
 (0)