You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Node 10.16.3
node-ssh 10.0.1
Firebase cloud function environment
I'm running into an issue putting a file into a subdirectory that doesn't exist. Looking at the code, https://github.com/steelbrain/node-ssh/blob/master/src/index.ts#L475, it looks like it is supposed to handle creating subdirectories that don't exist on the target share. Also, I suspect there are test cases for this. Regardless, I am running into trouble.
this is undefined, but sftp is not. Should it be binding this in the promise call?
This fixes it for me:
constputFile=(retry: boolean)=>{returnnewPromise(function(resolve,reject){sftp.fastPut(localFile,unixifyPath(remoteFile),transferOptions||{},err=>{if(err==null){resolve()return}if(err.message==='No such file'&&retry){resolve(this.mkdir(fsPath.dirname(remoteFile),'sftp',sftp).then(()=>putFile(false)))}else{reject(err)}})}.bind(this))}
There are other calls where this.mkdir is being wrapped by a promise, but I'm not using those methods, they may behave similarly.
The text was updated successfully, but these errors were encountered:
One other point - I cannot imagine that this is broken like this and no one else has posted a bug report. Could I be doing something wrong, or is the share I'm connecting to somehow non-standard?
Node 10.16.3
node-ssh 10.0.1
Firebase cloud function environment
I'm running into an issue putting a file into a subdirectory that doesn't exist. Looking at the code, https://github.com/steelbrain/node-ssh/blob/master/src/index.ts#L475, it looks like it is supposed to handle creating subdirectories that don't exist on the target share. Also, I suspect there are test cases for this. Regardless, I am running into trouble.
When trying to put a file:
I get this error:
this
is undefined, but sftp is not. Should it be bindingthis
in the promise call?This fixes it for me:
There are other calls where this.mkdir is being wrapped by a promise, but I'm not using those methods, they may behave similarly.
The text was updated successfully, but these errors were encountered: