diff --git a/app/logical/d_text.rb b/app/logical/d_text.rb index 22d6c6572..f95d58742 100644 --- a/app/logical/d_text.rb +++ b/app/logical/d_text.rb @@ -244,7 +244,7 @@ class DText end def self.sanitize(text) - text.gsub!(/<( |-|\Z)/, "<\\1") + text.gsub!(/<( |-|3|:|>|\Z)/, "<\\1") Sanitize.clean( text, diff --git a/db/structure.sql b/db/structure.sql index 810d06d49..e7e90f23b 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -6427,4 +6427,6 @@ INSERT INTO schema_migrations (version) VALUES ('20130618230158'); INSERT INTO schema_migrations (version) VALUES ('20130620215658'); -INSERT INTO schema_migrations (version) VALUES ('20130712162600'); \ No newline at end of file +INSERT INTO schema_migrations (version) VALUES ('20130712162600'); + +INSERT INTO schema_migrations (version) VALUES ('20130914175431'); \ No newline at end of file diff --git a/test/unit/dtext_test.rb b/test/unit/dtext_test.rb index a407f2335..f5737393b 100644 --- a/test/unit/dtext_test.rb +++ b/test/unit/dtext_test.rb @@ -5,6 +5,10 @@ class DTextTest < ActiveSupport::TestCase DText.parse(s) end + def test_sanitize_heart + assert_equal('

<3

', p("<3")) + end + def test_sanitize_less_than assert_equal('

<

', p("<")) end