Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

corrected escape_javascript #5

Closed
wants to merge 1 commit into from

2 participants

@nagybence

escape javascript no longer absorbs the '<' character from html tags if no '/' follows it

greetings, Bence

@brianmario
Owner

Good catch, thanks!

@brianmario
Owner

Pulled in, I'll try and push a new gem tomorrow or tuesday

@nagybence

its my pleasure :)

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
2  VERSION
@@ -1 +1 @@
-0.1.5
+0.1.6
View
21 escape_utils.gemspec
@@ -5,11 +5,11 @@
Gem::Specification.new do |s|
s.name = %q{escape_utils}
- s.version = "0.1.5"
+ s.version = "0.1.6"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Brian Lopez"]
- s.date = %q{2010-08-07}
+ s.date = %q{2010-09-05}
s.email = %q{seniorlopez@gmail.com}
s.extensions = ["ext/extconf.rb"]
s.extra_rdoc_files = [
@@ -41,14 +41,19 @@ Gem::Specification.new do |s|
"lib/escape_utils/url/cgi.rb",
"lib/escape_utils/url/erb.rb",
"lib/escape_utils/url/rack.rb",
+ "lib/escape_utils/url/uri.rb",
"spec/html/escape_spec.rb",
"spec/html/unescape_spec.rb",
"spec/html_safety_spec.rb",
"spec/javascript/escape_spec.rb",
"spec/javascript/unescape_spec.rb",
+ "spec/query/escape_spec.rb",
+ "spec/query/unescape_spec.rb",
"spec/rcov.opts",
"spec/spec.opts",
- "spec/spec_helper.rb"
+ "spec/spec_helper.rb",
+ "spec/uri/escape_spec.rb",
+ "spec/uri/unescape_spec.rb"
]
s.homepage = %q{http://github.com/brianmario/escape_utils}
s.rdoc_options = ["--charset=UTF-8"]
@@ -56,13 +61,15 @@ Gem::Specification.new do |s|
s.rubygems_version = %q{1.3.7}
s.summary = %q{Faster string escaping routines for your web apps}
s.test_files = [
- "spec/html/escape_spec.rb",
- "spec/html/unescape_spec.rb",
- "spec/html_safety_spec.rb",
- "spec/javascript/escape_spec.rb",
+ "spec/javascript/escape_spec.rb",
"spec/javascript/unescape_spec.rb",
+ "spec/html/escape_spec.rb",
+ "spec/html/unescape_spec.rb",
"spec/query/escape_spec.rb",
"spec/query/unescape_spec.rb",
+ "spec/html_safety_spec.rb",
+ "spec/uri/escape_spec.rb",
+ "spec/uri/unescape_spec.rb",
"spec/spec_helper.rb"
]
View
6 ext/escape_utils.c
@@ -114,8 +114,9 @@ static size_t escape_javascript(unsigned char *out, const unsigned char *in, siz
total++;
break;
case '<':
+ *out++ = '<';
if (*in == '/') {
- *out++ = '<'; *out++ = '\\'; *out++ = '/';
+ *out++ = '\\'; *out++ = '/';
in++; in_len--;
total++;
}
@@ -592,4 +593,5 @@ void Init_escape_utils_ext() {
#ifdef HAVE_RUBY_ENCODING_H
utf8Encoding = rb_utf8_encoding();
#endif
-}
+}
+
View
5 spec/javascript/escape_spec.rb
@@ -20,7 +20,7 @@
end
it "should escape closed html tags" do
- EscapeUtils.escape_javascript(%(dont </close> tags)).should eql(%(dont <\\/close> tags))
+ EscapeUtils.escape_javascript(%(keep <open>, but dont </close> tags)).should eql(%(keep <open>, but dont <\\/close> tags))
end
if RUBY_VERSION =~ /^1.9/
@@ -36,4 +36,5 @@
EscapeUtils.escape_javascript(%(dont </close> tags)).encoding.should eql(Encoding.default_internal)
end
end
-end
+end
+
Something went wrong with that request. Please try again.