Skip to content

Commit

Permalink
Fixed a bug when an error occurred when using implicit FTPS (FTP over…
Browse files Browse the repository at this point in the history
… TLS). (#18908)

* Fixed an issue with FTPUploadV2 task when using implicit FTPS.

* Changed the version of the task.

* Update the minor version in task.json

* Updated the minor version in task.loc.json

Co-authored-by: Konstantin Tyukalov <[email protected]>

---------

Co-authored-by: Konstantin Tyukalov <[email protected]>
  • Loading branch information
DenisNikulin5 and KonstantinTyukalov authored Sep 18, 2023
1 parent 39f4908 commit 00b1c59
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"loc.input.label.serverUrl": "Server URL",
"loc.input.label.username": "Username",
"loc.input.label.password": "Password",
"loc.input.label.implicitFTPS": "Use implicit FTPS",
"loc.input.label.rootFolder": "Root folder",
"loc.input.help.rootFolder": "The source folder to upload files from.",
"loc.input.label.filePatterns": "File patterns",
Expand Down
12 changes: 11 additions & 1 deletion Tasks/FtpUploadV2/ftpuploadtask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ interface FtpOptions {
cleanContents: boolean;
preservePaths: boolean;
trustSSL: boolean;
implicitFTPS: boolean;
enableUtf8: boolean;
customCmds: string[];
}
Expand Down Expand Up @@ -199,14 +200,23 @@ function getFtpOptions(): FtpOptions {
cleanContents: tl.getBoolInput("cleanContents", false),
preservePaths: tl.getBoolInput("preservePaths", true),
trustSSL: tl.getBoolInput("trustSSL", true),
implicitFTPS: tl.getBoolInput("implicitFTPS", false),
enableUtf8: tl.getBoolInput("enableUtf8", false),
customCmds: tl.getDelimitedInput("customCmds", "\n", false)

};
}

function getAccessOption(options: FtpOptions): ftp.AccessOptions {
const protocol = options.serverEndpointUrl.protocol;
const secure: boolean = protocol != undefined ? protocol.toLowerCase() === "ftps:" : false;
let secure: boolean | "implicit";
if (options.implicitFTPS) {
secure = "implicit";
}
else {
secure = !!protocol && protocol.toLowerCase() === "ftps:";
}

const secureOptions: any = { rejectUnauthorized: !options.trustSSL };

const hostName: string = options.serverEndpointUrl.hostname!;
Expand Down
11 changes: 9 additions & 2 deletions Tasks/FtpUploadV2/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"demands": [],
"version": {
"Major": 2,
"Minor": 211,
"Minor": 228,
"Patch": 0
},
"minimumAgentVersion": "2.182.1",
Expand Down Expand Up @@ -79,6 +79,13 @@
"required": true,
"visibleRule": "credsType = inputs"
},
{
"name": "implicitFTPS",
"type": "boolean",
"label": "Use implicit FTPS",
"defaultValue": "false",
"required": false
},
{
"name": "rootFolder",
"aliases": [
Expand Down Expand Up @@ -208,4 +215,4 @@
"UploadSucceedRes": "FTP upload successful",
"UploadFailed": "Ftp Upload failed"
}
}
}
9 changes: 8 additions & 1 deletion Tasks/FtpUploadV2/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"demands": [],
"version": {
"Major": 2,
"Minor": 211,
"Minor": 228,
"Patch": 0
},
"minimumAgentVersion": "2.182.1",
Expand Down Expand Up @@ -79,6 +79,13 @@
"required": true,
"visibleRule": "credsType = inputs"
},
{
"name": "implicitFTPS",
"type": "boolean",
"label": "ms-resource:loc.input.label.implicitFTPS",
"defaultValue": "false",
"required": false
},
{
"name": "rootFolder",
"aliases": [
Expand Down

0 comments on commit 00b1c59

Please sign in to comment.