diff --git a/lib/redcloth.rb b/lib/redcloth.rb index 421346cc7..7111de513 100644 --- a/lib/redcloth.rb +++ b/lib/redcloth.rb @@ -465,8 +465,7 @@ class RedCloth < String style << "vertical-align:#{ v_align( $& ) };" if text =~ A_VLGN end - style << "#{ htmlesc $1 };" if not filter_styles and - text.sub!( /\{([^}]*)\}/, '' ) + style << "#{ htmlesc $1 };" if text.sub!( /\{([^}]*)\}/, '' ) && !filter_styles lang = $1 if text.sub!( /\[([^)]+?)\]/, '' ) diff --git a/lib/redmine/wiki_formatting.rb b/lib/redmine/wiki_formatting.rb index 39b81e44a..3fbb108ad 100644 --- a/lib/redmine/wiki_formatting.rb +++ b/lib/redmine/wiki_formatting.rb @@ -32,6 +32,7 @@ module Redmine super self.hard_breaks=true self.no_span_caps=true + self.filter_styles=true end def to_html(*rules, &block) diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index 04449d921..9b8debc97 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -49,7 +49,8 @@ class ApplicationHelperTest < HelperTestCase '!http://foo.bar/image.jpg!' => '', 'floating !>http://foo.bar/image.jpg!' => 'floating
', 'with class !(some-class)http://foo.bar/image.jpg!' => 'with class ', - 'with style !{width:100px;height100px}http://foo.bar/image.jpg!' => 'with style ', + # inline styles should be stripped + 'with style !{width:100px;height100px}http://foo.bar/image.jpg!' => 'with style ', 'with title !http://foo.bar/image.jpg(This is a title)!' => 'with title This is a title', 'with title !http://foo.bar/image.jpg(This is a double-quoted "title")!' => 'with title This is a double-quoted "title"', }