Skip to content
This repository has been archived by the owner on Jul 1, 2021. It is now read-only.

Commit

Permalink
fixed setting file modes in SFTP
Browse files Browse the repository at this point in the history
  • Loading branch information
mkloubert committed Jun 16, 2017
1 parent e68cf96 commit 49081cf
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log (vs-deploy)

## 9.26.0 (June 16th, 2017; SFTP)

* bugfixes in [sftp target](https://github.com/mkloubert/vs-deploy/wiki/target_sftp) when setting [file mode](https://github.com/mkloubert/vs-deploy/wiki/target_sftp#modes-for-specific-files) after a file has been uploaded

## 9.25.0 (June 12th, 2017; russian translation)

* [russian translation](https://github.com/mkloubert/vs-deploy/blob/master/src/lang/ru.ts) updated by [sag3ll0](https://github.com/sag3ll0)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vs-deploy",
"displayName": "Deploy",
"description": "Commands for deploying files of your workspace to a destination.",
"version": "9.25.0",
"version": "9.26.0",
"publisher": "mkloubert",
"engines": {
"vscode": "^1.6.0"
Expand Down
21 changes: 15 additions & 6 deletions src/plugins/sftp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -543,10 +543,7 @@ class SFtpPlugin extends deploy_objects.DeployPluginWithContextBase<SFTPContext>
mode = asOctalNumber(target.modes);
}

if (deploy_helpers.isNullUndefinedOrEmptyString(mode)) {
putOpts = undefined;
}
else {
if (!deploy_helpers.isNullUndefinedOrEmptyString(mode)) {
putOpts['mode'] = mode;
}
}
Expand Down Expand Up @@ -726,8 +723,20 @@ class SFtpPlugin extends deploy_objects.DeployPluginWithContextBase<SFTPContext>
// upload
putWorkflow.next(() => {
return new Promise<any>((resolve, reject) => {
ctx.connection.put(dataToUpload, targetFile, putOpts).then(() => {
resolve();
ctx.connection.put(dataToUpload, targetFile).then(() => {
if (deploy_helpers.isNullOrUndefined(putOpts['mode'])) {
resolve();
}
else {
ctx.connection.sftp.chmod(targetFile, putOpts['mode'], (err) => {
if (err) {
reject(err);
}
else {
resolve();
}
});
}
}).catch((e) => {
reject(e);
});
Expand Down

0 comments on commit 49081cf

Please sign in to comment.