unicorn-cuba-base 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/unicorn-cuba-base/uri_ext.rb +9 -4
- data/unicorn-cuba-base.gemspec +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.
|
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
|
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
|
data/unicorn-cuba-base.gemspec
CHANGED
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.
|
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:
|
226
|
+
hash: 4349117855250355061
|
227
227
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
228
228
|
none: false
|
229
229
|
requirements:
|