sinatra 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sinatra might be problematic. Click here for more details.
- checksums.yaml +5 -5
- data/CHANGELOG.md +65 -43
- data/Gemfile +1 -0
- data/README.de.md +2 -2
- data/README.es.md +2 -2
- data/README.fr.md +2 -2
- data/README.ja.md +15 -16
- data/README.ko.md +2 -2
- data/README.md +1 -1
- data/README.pt-br.md +2 -2
- data/README.ru.md +381 -364
- data/README.zh.md +2 -2
- data/VERSION +1 -1
- data/lib/sinatra/base.rb +7 -6
- data/lib/sinatra/indifferent_hash.rb +5 -0
- data/lib/sinatra/version.rb +1 -1
- metadata +5 -5
data/README.zh.md
CHANGED
@@ -660,7 +660,7 @@ get('/') { markdown :index }
|
|
660
660
|
<table>
|
661
661
|
<tr>
|
662
662
|
<td>依赖项</td>
|
663
|
-
<td><a href="
|
663
|
+
<td><a href="https://shopify.github.io/liquid/" title="liquid">liquid</a></td>
|
664
664
|
</tr>
|
665
665
|
<tr>
|
666
666
|
<td>文件扩展名</td>
|
@@ -683,7 +683,7 @@ get('/') { markdown :index }
|
|
683
683
|
下列任一:
|
684
684
|
<a href="https://github.com/davidfstr/rdiscount" title="RDiscount">RDiscount</a>,
|
685
685
|
<a href="https://github.com/vmg/redcarpet" title="RedCarpet">RedCarpet</a>,
|
686
|
-
<a href="
|
686
|
+
<a href="https://github.com/ged/bluecloth" title="bluecloth">BlueCloth</a>,
|
687
687
|
<a href="http://kramdown.gettalong.org/" title="kramdown">kramdown</a>,
|
688
688
|
<a href="https://github.com/bhollis/maruku" title="maruku">maruku</a>
|
689
689
|
</td>
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.2
|
data/lib/sinatra/base.rb
CHANGED
@@ -78,7 +78,7 @@ module Sinatra
|
|
78
78
|
def params
|
79
79
|
super
|
80
80
|
rescue Rack::Utils::ParameterTypeError, Rack::Utils::InvalidParameterError => e
|
81
|
-
raise BadRequest, "Invalid query parameters: #{e.message}"
|
81
|
+
raise BadRequest, "Invalid query parameters: #{Rack::Utils.escape_html(e.message)}"
|
82
82
|
end
|
83
83
|
|
84
84
|
private
|
@@ -132,7 +132,7 @@ module Sinatra
|
|
132
132
|
# http://rubydoc.info/github/rack/rack/master/Rack/Response
|
133
133
|
# http://rubydoc.info/github/rack/rack/master/Rack/Response/Helpers
|
134
134
|
class Response < Rack::Response
|
135
|
-
DROP_BODY_RESPONSES = [204,
|
135
|
+
DROP_BODY_RESPONSES = [204, 304]
|
136
136
|
def initialize(*)
|
137
137
|
super
|
138
138
|
headers['Content-Type'] ||= 'text/html'
|
@@ -461,7 +461,7 @@ module Sinatra
|
|
461
461
|
# Specify response freshness policy for HTTP caches (Cache-Control header).
|
462
462
|
# Any number of non-value directives (:public, :private, :no_cache,
|
463
463
|
# :no_store, :must_revalidate, :proxy_revalidate) may be passed along with
|
464
|
-
# a Hash of value directives (:max_age, :
|
464
|
+
# a Hash of value directives (:max_age, :s_maxage).
|
465
465
|
#
|
466
466
|
# cache_control :public, :must_revalidate, :max_age => 60
|
467
467
|
# => Cache-Control: public, must-revalidate, max-age=60
|
@@ -1023,13 +1023,14 @@ module Sinatra
|
|
1023
1023
|
return unless params = pattern.params(route)
|
1024
1024
|
|
1025
1025
|
params.delete("ignore") # TODO: better params handling, maybe turn it into "smart" object or detect changes
|
1026
|
+
force_encoding(params)
|
1026
1027
|
original, @params = @params, @params.merge(params) if params.any?
|
1027
1028
|
|
1028
1029
|
regexp_exists = pattern.is_a?(Mustermann::Regular) || (pattern.respond_to?(:patterns) && pattern.patterns.any? {|subpattern| subpattern.is_a?(Mustermann::Regular)} )
|
1029
1030
|
if regexp_exists
|
1030
1031
|
captures = pattern.match(route).captures
|
1031
1032
|
values += captures
|
1032
|
-
@params[:captures] = captures
|
1033
|
+
@params[:captures] = force_encoding(captures) unless captures.nil? || captures.empty?
|
1033
1034
|
else
|
1034
1035
|
values += params.values.flatten
|
1035
1036
|
end
|
@@ -1247,8 +1248,8 @@ module Sinatra
|
|
1247
1248
|
end
|
1248
1249
|
end
|
1249
1250
|
|
1250
|
-
define_singleton("#{option}=", setter)
|
1251
|
-
define_singleton(option, getter)
|
1251
|
+
define_singleton("#{option}=", setter)
|
1252
|
+
define_singleton(option, getter)
|
1252
1253
|
define_singleton("#{option}?", "!!#{option}") unless method_defined? "#{option}?"
|
1253
1254
|
self
|
1254
1255
|
end
|
@@ -104,6 +104,11 @@ module Sinatra
|
|
104
104
|
super(*keys.map(&method(:convert_key)))
|
105
105
|
end if method_defined?(:fetch_values) # Added in Ruby 2.3
|
106
106
|
|
107
|
+
def slice(*keys)
|
108
|
+
keys.map!(&method(:convert_key))
|
109
|
+
self.class[super(*keys)]
|
110
|
+
end if method_defined?(:slice) # Added in Ruby 2.5
|
111
|
+
|
107
112
|
def values_at(*keys)
|
108
113
|
super(*keys.map(&method(:convert_key)))
|
109
114
|
end
|
data/lib/sinatra/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Blake Mizerany
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2018-
|
14
|
+
date: 2018-06-05 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rack
|
@@ -47,14 +47,14 @@ dependencies:
|
|
47
47
|
requirements:
|
48
48
|
- - '='
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
version: 2.0.
|
50
|
+
version: 2.0.2
|
51
51
|
type: :runtime
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
54
54
|
requirements:
|
55
55
|
- - '='
|
56
56
|
- !ruby/object:Gem::Version
|
57
|
-
version: 2.0.
|
57
|
+
version: 2.0.2
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: mustermann
|
60
60
|
requirement: !ruby/object:Gem::Requirement
|
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
148
|
version: '0'
|
149
149
|
requirements: []
|
150
150
|
rubyforge_project:
|
151
|
-
rubygems_version: 2.6
|
151
|
+
rubygems_version: 2.7.6
|
152
152
|
signing_key:
|
153
153
|
specification_version: 4
|
154
154
|
summary: Classy web-development dressed in a DSL
|