Code Monkey home page Code Monkey logo

fun_sftp's Issues

NoMethodError: undefined method 'Pathname' when calling chdir

I created a PR for this: #8

On ruby-2.4.2 I observed that the Pathname was undefined within the SftpClient class.

I also observed that it IS defined when the tests are run. I couldn't figure out the discrepancy between the two situations. But I did observe that requiring pathname solved my issue.

File incorrectly identified as a Directory using Windows CoreSFTP server

I'm having a difficult issue using FunSftp, where unfortunately, our test SFTP server is a Linux server with OpenSSH, while the production server is Windows-based running CoreFTP.

Here's a snapshot of my usage:

conn = SFTPClient.new(ENV['SFTP_HOST'], ENV['SFTP_USERNAME'], nil,
                     :port => ENV['SFTP_PORT'], :password => ENV['SFTP_PASSWORD'],
                     :non_interactive => true)
conn.chdir(ENV['SFTP_DIR'])
files = conn.glob('.', filename_pattern)
files.each do |file|
  conn.download!(file, local_path)
end

Against a Linux SFTP server, this works great. Against a Windows server, the code behind conn.download! identifies the file as a Directory, creates a directory locally in the local path with the name of the file, and then tries to download the file from within a directory. It fails that attempt.

Digging into the download! method here, I see it makes the download recursive if has_directory? returns true. On Windows, has_directory?'s call through Net::SFTP incorrectly returns the filename of the file I'm trying to download instead of throwing the Net::SFTP::StatusException like it does on Linux.

If the download! method supported overriding the recursive method, that would be a workaround. But, maybe there's something else going on behind the scenes.

IO closed stream

Hello

I am having issues when I upload a file to an SFTP server, the file successfully places on the server however I am getting a "Closed Stream" error returned. Would you have any idea what causes this or how to resolve it? Thanks!

begin
  conn = SFTPClient.new(details)
  if conn
    conn.upload!(@file_path, "#{@connection.connection_path}/#{@file_name}")
  end
rescue Net::SFTP::StatusException => e
  raise e
 end

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.