Skip to content

Commit 6f9b7a5

Browse files
authored
[ruby/rage] Use ERB::Escape for html escaping (#10175)
It should be slight faster as it doesn't allocate a new string when nothing needs to be escaped. https://github.com/ruby/erb/blob/6a5729b7e291e30432f3955e443cc3e6c9215b60/ext/erb/escape/escape.c
1 parent 5b03eb9 commit 6f9b7a5

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

frameworks/Ruby/rage-sequel/app/views/fortunes.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<table>
66
<tr><th>id</th><th>message</th></tr>
77
<% records.each do |record| %>
8-
<tr><td><%= record.id %></td><td><%= CGI.escape_html(record.message) %></td></tr>
8+
<tr><td><%= record.id %></td><td><%= ERB::Escape.html_escape(record.message) %></td></tr>
99
<% end %>
1010
</table>
1111
</body>

frameworks/Ruby/rage/app/views/fortunes.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<table>
66
<tr><th>id</th><th>message</th></tr>
77
<% records.each do |record| %>
8-
<tr><td><%= record[:id] %></td><td><%= CGI.escape_html(record[:message]) %></td></tr>
8+
<tr><td><%= record[:id] %></td><td><%= ERB::Escape.html_escape(record[:message]) %></td></tr>
99
<% end %>
1010
</table>
1111
</body>

0 commit comments

Comments
 (0)