Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library incorrectly assumes 'stat' result to contain a value for 'size' #70

Closed
hrimhari opened this issue May 24, 2017 · 2 comments
Closed

Comments

@hrimhari
Copy link
Contributor

hrimhari commented May 24, 2017

The SFTP protocol allows a server to choose what information to return to a 'stat' command.

When talking to a SSH Tectia Server 5.5 for IBM z/OS and attempting to get a dataset, the server will not return the 'size'. This causes the operation to fail here:

buffer.js:275
  throw new TypeError(kFromErrorMsg);
  ^

TypeError: First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.
    at fromObject (buffer.js:275:9)
    at Function.Buffer.from (buffer.js:107:10)
    at new Buffer (buffer.js:86:17)
    at tryStat (/Users/fcarasso/Dev/cdr-merger/node_modules/ssh2-streams/lib/sftp.js:1246:16)
    at SFTPStream._transform (/Users/fcarasso/Dev/cdr-merger/node_modules/ssh2-streams/lib/sftp.js:496:15)
    at SFTPStream.Transform._read (_stream_transform.js:167:10)
(...)

I could quickly work around the issue by replacing:

 1238:     size = st.size;

with

1238:      size = st.size || 0;
@hrimhari
Copy link
Contributor Author

Pull request: #71

@hrimhari
Copy link
Contributor Author

@mscdex bump

@mscdex mscdex closed this as completed in 5ee458d May 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant