diff options
-rw-r--r-- | lib/rack/media_type.rb | 2 | ||||
-rw-r--r-- | lib/rack/multipart/parser.rb | 2 | ||||
-rw-r--r-- | lib/rack/request.rb | 2 | ||||
-rw-r--r-- | lib/rack/static.rb | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/lib/rack/media_type.rb b/lib/rack/media_type.rb index c68df50f..41937c99 100644 --- a/lib/rack/media_type.rb +++ b/lib/rack/media_type.rb @@ -36,7 +36,7 @@ module Rack private def strip_doublequotes(str) - (str[0] == ?" && str[-1] == ?") ? str[1..-2] : str + (str.start_with?('"') && str.end_with?('"')) ? str[1..-2] : str end end end diff --git a/lib/rack/multipart/parser.rb b/lib/rack/multipart/parser.rb index f4e8e445..7c38d5f3 100644 --- a/lib/rack/multipart/parser.rb +++ b/lib/rack/multipart/parser.rb @@ -352,7 +352,7 @@ module Rack k, v = param.split('=', 2) k.strip! v.strip! - v = v[1..-2] if v[0] == '"' && v[-1] == '"' + v = v[1..-2] if v.start_with?('"') && v.end_with?('"') encoding = Encoding.find v if k == CHARSET end end diff --git a/lib/rack/request.rb b/lib/rack/request.rb index 3cb27651..54ea86c4 100644 --- a/lib/rack/request.rb +++ b/lib/rack/request.rb @@ -358,7 +358,7 @@ module Rack # Fix for Safari Ajax postings that always append \0 # form_vars.sub!(/\0\z/, '') # performance replacement: - form_vars.slice!(-1) if form_vars[-1] == ?\0 + form_vars.slice!(-1) if form_vars.end_with?("\0") set_header RACK_REQUEST_FORM_VARS, form_vars set_header RACK_REQUEST_FORM_HASH, parse_query(form_vars, '&') diff --git a/lib/rack/static.rb b/lib/rack/static.rb index 3c76a847..24c40505 100644 --- a/lib/rack/static.rb +++ b/lib/rack/static.rb @@ -104,7 +104,7 @@ module Rack end def add_index_root?(path) - @index && route_file(path) && /\/$/.match?(path) + @index && route_file(path) && path.end_with?('/'.freeze) end def overwrite_file_path(path) |