This commit is contained in:
r888888888
2013-09-26 17:21:59 -07:00
parent 5c55e90810
commit 9e45158423
3 changed files with 8 additions and 2 deletions

View File

@@ -244,7 +244,7 @@ class DText
end end
def self.sanitize(text) def self.sanitize(text)
text.gsub!(/<( |-|\Z)/, "&lt;\\1") text.gsub!(/<( |-|3|:|>|\Z)/, "&lt;\\1")
Sanitize.clean( Sanitize.clean(
text, text,

View File

@@ -6428,3 +6428,5 @@ INSERT INTO schema_migrations (version) VALUES ('20130618230158');
INSERT INTO schema_migrations (version) VALUES ('20130620215658'); INSERT INTO schema_migrations (version) VALUES ('20130620215658');
INSERT INTO schema_migrations (version) VALUES ('20130712162600'); INSERT INTO schema_migrations (version) VALUES ('20130712162600');
INSERT INTO schema_migrations (version) VALUES ('20130914175431');

View File

@@ -5,6 +5,10 @@ class DTextTest < ActiveSupport::TestCase
DText.parse(s) DText.parse(s)
end end
def test_sanitize_heart
assert_equal('<p>&lt;3</p>', p("<3"))
end
def test_sanitize_less_than def test_sanitize_less_than
assert_equal('<p>&lt;</p>', p("<")) assert_equal('<p>&lt;</p>', p("<"))
end end