lib/file_locator.rb in active_encode-1.1.1 vs lib/file_locator.rb in active_encode-1.1.2
- old
+ new
@@ -9,11 +9,11 @@
attr_reader :bucket, :key
def initialize(uri)
uri = Addressable::URI.parse(uri)
@bucket = Addressable::URI.unencode(uri.host)
- @key = Addressable::URI.unencode(uri.path).sub(%r{^/*(.+)/*$}, '\1')
+ @key = Addressable::URI.unencode(ActiveEncode.sanitize_uri(uri)).sub(%r{^/*(.+)/*$}, '\1')
end
def object
@object ||= Aws::S3::Object.new(bucket_name: bucket, key: key)
end
@@ -49,10 +49,10 @@
def location
case uri.scheme
when 's3'
S3File.new(uri).object.presigned_url(:get)
when 'file'
- Addressable::URI.unencode(uri.path)
+ Addressable::URI.unencode(ActiveEncode.sanitize_uri(uri))
else
@uri.to_s
end
end