mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Replaced the 'unicode' gem with 'unf' so it'll work with JRuby.
Fixes #2279: Remove dependency on "unicode" gem.
This commit is contained in:
parent
d20617ff0c
commit
69988cbc1d
3 changed files with 4 additions and 20 deletions
|
@ -50,7 +50,7 @@ Gem::Specification.new do |s|
|
|||
s.add_dependency('net-ssh', '>=2.1.3')
|
||||
s.add_dependency('nokogiri', '~>1.5')
|
||||
s.add_dependency('ruby-hmac')
|
||||
s.add_dependency('unicode', "~> 0.4.4") unless RUBY_PLATFORM == 'java'
|
||||
s.add_dependency('unf')
|
||||
|
||||
## List your development dependencies here. Development dependencies are
|
||||
## those that are only needed during development
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
require 'fog/core'
|
||||
require 'fog/aws/credential_fetcher'
|
||||
require 'fog/aws/signaturev4'
|
||||
begin
|
||||
require 'unicode'
|
||||
rescue LoadError
|
||||
# Temporarily ignored. This should only impact JRuby.
|
||||
end
|
||||
require 'unf/normalizer'
|
||||
|
||||
module Fog
|
||||
module AWS
|
||||
|
@ -91,13 +87,7 @@ module Fog
|
|||
end
|
||||
|
||||
def self.escape(string)
|
||||
string = begin
|
||||
::Unicode::normalize_C(string)
|
||||
rescue
|
||||
Fog::Logger.warning("Fog::AWS string escaping will not normalize Unicode characters on JRuby, pending a fix for issue #2279")
|
||||
string
|
||||
end
|
||||
|
||||
string = ::UNF::Normalizer.normalize(string, :nfc)
|
||||
string.gsub(/([^a-zA-Z0-9_.\-~]+)/) {
|
||||
"%" + $1.unpack("H2" * $1.bytesize).join("%").upcase
|
||||
}
|
||||
|
|
|
@ -170,13 +170,7 @@ module Fog
|
|||
|
||||
# NOTE: differs from Fog::AWS.escape by NOT escaping `/`
|
||||
def escape(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 = ::UNF::Normalizer.normalize(string, :nfc)
|
||||
string.gsub(/([^a-zA-Z0-9_.\-~\/]+)/) {
|
||||
"%" + $1.unpack("H2" * $1.bytesize).join("%").upcase
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue