unicorn-cuba-base 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.1
1
+ 1.2.2
@@ -11,15 +11,20 @@ module URI
11
11
  def self.utf_decode(str)
12
12
  pct_decode(str) # decode %XX bits
13
13
  .force_encoding('UTF-8') # Make sure the string is interpreting UTF-8 chars
14
+ .tap{|uri| validate_string_encoding(uri)}
14
15
  .gsub(/%u([0-9a-z]{4})/) {|s| [$1.to_i(16)].pack("U")} # Decode %uXXXX encoded chars (JavaScript.encode())
15
- .tap do |u|
16
- # Validate fins string
17
- raise URI::InvalidURIError, "invalid UTF-8 encoding in URI: #{u.inspect}" if not u.valid_encoding?
18
- end
16
+ .tap{|uri| validate_string_encoding(uri)}
19
17
  end
20
18
 
19
+
21
20
  # Use it by default
22
21
  def self.decode(str)
23
22
  self.utf_decode(str)
24
23
  end
24
+
25
+ private
26
+
27
+ def self.validate_string_encoding(uri)
28
+ raise URI::InvalidURIError, "invalid UTF-8 encoding in URI: #{uri.inspect}" if not uri.valid_encoding?
29
+ end
25
30
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "unicorn-cuba-base"
8
- s.version = "1.2.1"
8
+ s.version = "1.2.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jakub Pastuszek"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unicorn-cuba-base
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -223,7 +223,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
223
223
  version: '0'
224
224
  segments:
225
225
  - 0
226
- hash: -870267465513696600
226
+ hash: 4349117855250355061
227
227
  required_rubygems_version: !ruby/object:Gem::Requirement
228
228
  none: false
229
229
  requirements: