lib/io_streams/paths/sftp.rb in iostreams-1.0.0.beta5 vs lib/io_streams/paths/sftp.rb in iostreams-1.0.0.beta6
- old
+ new
@@ -71,10 +71,15 @@
URI.decode_www_form(uri.query).each { |key, value| @ssh_options[key] = value } if uri.query
super(uri.path)
end
+ # Does not support relative file names since there is no concept of current working directory
+ def relative?
+ false
+ end
+
def to_s
url
end
# Note that mkdir is delayed and only executed when the file write is performed.
@@ -202,13 +207,13 @@
Utils.temp_file_name('iostreams-sftp-args', 'key') do |file_name|
options = ssh_options.dup
key = options.delete('IdentityKey')
# sftp requires that private key is only readable by the current user
- File.open(file_name, 'wb', 0600) { |io| io.write(key) }
+ ::File.open(file_name, 'wb', 0600) { |io| io.write(key) }
options['IdentityFile'] = file_name
- yield sftp_args(ssh_options)
+ yield sftp_args(options)
end
end
def sftp_args(ssh_options)
args = [self.class.sshpass_bin, self.class.sftp_bin]