We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 38c6e18 commit ecebf80Copy full SHA for ecebf80
ext/erb/erb.c
@@ -55,18 +55,18 @@ optimized_escape_html(VALUE str)
55
}
56
57
58
- VALUE escaped;
+ VALUE escaped = str;
59
if (RSTRING_LEN(str) < (dest - buf)) {
60
escaped = rb_str_new(buf, dest - buf);
61
preserve_original_state(str, escaped);
62
63
- else {
64
- escaped = rb_str_dup(str);
65
- }
66
ALLOCV_END(vbuf);
67
return escaped;
68
69
+// ERB::Util.html_escape is different from CGI.escapeHTML in the following two parts:
+// * ERB::Util.html_escape converts an argument with #to_s first (only if it's not T_STRING)
+// * ERB::Util.html_escape does not allocate a new string when nothing needs to be escaped
70
static VALUE
71
erb_escape_html(VALUE self, VALUE str)
72
{
0 commit comments