lib/io_streams/paths/sftp.rb in iostreams-1.0.0.beta6 vs lib/io_streams/paths/sftp.rb in iostreams-1.0.0.beta7
- old
+ new
@@ -53,11 +53,11 @@
# # When using the sftp executable use an identity file instead of a password to authenticate:
# IOStreams.path("sftp://test.com/path/file_name.csv", username: "jack", IdentityFile: "~/.ssh/private_key").reader do |io|
# puts io.read
# end
def initialize(url, username: nil, password: nil, ruby: true, ssh_options: {})
- uri = URI.parse(url)
+ uri = Utils::URI.new(url)
raise(ArgumentError, "Invalid URL. Required Format: 'sftp://<host_name>/<file_name>'") unless uri.scheme == 'sftp'
@hostname = uri.hostname
@mkdir = false
@username = username || uri.user
@@ -65,11 +65,10 @@
@password = password || uri.password
@port = uri.port || 22
# Not Ruby 2.5 yet: transform_keys(&:to_s)
@ssh_options = {}
ssh_options.each_pair { |key, value| @ssh_options[key.to_s] = value }
-
- URI.decode_www_form(uri.query).each { |key, value| @ssh_options[key] = value } if uri.query
+ @ssh_options.merge(uri.query) if uri.query
super(uri.path)
end
# Does not support relative file names since there is no concept of current working directory