summaryrefslogtreecommitdiff
path: root/test/controllers/rss_controller_test.rb
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-08-09 23:31:35 +0200
committererdgeist <erdgeist@erdgeist.org>2026-08-09 23:31:35 +0200
commit5690cf4d4e05eafdfd2e270bbdf1a925114d0f76 (patch)
tree1315dd1b91433f5287208a4f1b321dd722592966 /test/controllers/rss_controller_test.rb
parent4d8c7290adf8dd41677ccc44a5c5ffe5d1bed2f6 (diff)
Escape feed content with Builder rather than by hand
Builder escapes by default; the three feed templates no longer call CGI.escapeHTML. This fixes two sites that never escaped at all: the tag feed's externally supplied :tag segment, interpolated into its title, self link and id, and dc:creator in the RDF template. Subscribers see one difference: quotes and apostrophes arrive raw, which is valid in element text. config/initializers/xmlparser.rb, which redefined Builder::XmlBase#_escape as the identity function, is gone. XML::Node#replace_with went with it, no callers.
Diffstat (limited to 'test/controllers/rss_controller_test.rb')
-rw-r--r--test/controllers/rss_controller_test.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/controllers/rss_controller_test.rb b/test/controllers/rss_controller_test.rb
index 00224119..4393c5fc 100644
--- a/test/controllers/rss_controller_test.rb
+++ b/test/controllers/rss_controller_test.rb
@@ -41,4 +41,19 @@ class RssControllerTest < ActionController::TestCase
41 assert_includes @response.body, "feed-inside" 41 assert_includes @response.body, "feed-inside"
42 assert_not_includes @response.body, "feed-outside" 42 assert_not_includes @response.body, "feed-outside"
43 end 43 end
44
45 test "the feed escapes markup characters in a title" do
46 updates = Node.root.children.find_by(:slug => "updates")
47 node = updates.children.create!(:slug => "feed-escaping")
48 node.reload.draft.update!(:title => %{Fnord & <b>bold</b> "quoted"},
49 :tag_list => "update")
50 node.publish_draft!
51
52 get :updates, params: { :format => :xml }
53
54 assert_response :success
55 assert_includes @response.body, "Fnord &amp; &lt;b&gt;bold&lt;/b&gt;"
56 assert_not_includes @response.body, "<b>bold</b>"
57 assert_not_includes @response.body, "&amp;amp;"
58 end
44end 59end