mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Handle another case of the 'unicode' gem breaking things on JRuby.
This is was an omission from pull request #2315.
This commit is contained in:
parent
f28ac60ab2
commit
dabed804b0
1 changed files with 8 additions and 2 deletions
|
@ -168,9 +168,15 @@ module Fog
|
|||
"/#{escape(bucket_name.to_s)}#{path}"
|
||||
end
|
||||
|
||||
# NOTE: differs fram Fog::AWS.escape by NOT escaping `/`
|
||||
# NOTE: differs from Fog::AWS.escape by NOT escaping `/`
|
||||
def escape(string)
|
||||
string = Unicode::normalize_C(string)
|
||||
string = begin
|
||||
::Unicode::normalize_C(string)
|
||||
rescue
|
||||
Fog::Logger.warning("Fog::Storage::AWS string escaping will not normalize Unicode characters on JRuby, pending a fix for issue #2279")
|
||||
string
|
||||
end
|
||||
|
||||
string.gsub(/([^a-zA-Z0-9_.\-~\/]+)/) {
|
||||
"%" + $1.unpack("H2" * $1.bytesize).join("%").upcase
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue