Skip to content

Commit 00b1c59

Browse files
Fixed a bug when an error occurred when using implicit FTPS (FTP over 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 <52399739+KonstantinTyukalov@users.noreply.github.com> --------- Co-authored-by: Konstantin Tyukalov <52399739+KonstantinTyukalov@users.noreply.github.com>
1 parent 39f4908 commit 00b1c59

File tree

4 files changed

+29
-4
lines changed

4 files changed

+29
-4
lines changed

Tasks/FtpUploadV2/Strings/resources.resjson/en-US/resources.resjson

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"loc.input.label.serverUrl": "Server URL",
1212
"loc.input.label.username": "Username",
1313
"loc.input.label.password": "Password",
14+
"loc.input.label.implicitFTPS": "Use implicit FTPS",
1415
"loc.input.label.rootFolder": "Root folder",
1516
"loc.input.help.rootFolder": "The source folder to upload files from.",
1617
"loc.input.label.filePatterns": "File patterns",

Tasks/FtpUploadV2/ftpuploadtask.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ interface FtpOptions {
2424
cleanContents: boolean;
2525
preservePaths: boolean;
2626
trustSSL: boolean;
27+
implicitFTPS: boolean;
2728
enableUtf8: boolean;
2829
customCmds: string[];
2930
}
@@ -199,14 +200,23 @@ function getFtpOptions(): FtpOptions {
199200
cleanContents: tl.getBoolInput("cleanContents", false),
200201
preservePaths: tl.getBoolInput("preservePaths", true),
201202
trustSSL: tl.getBoolInput("trustSSL", true),
203+
implicitFTPS: tl.getBoolInput("implicitFTPS", false),
202204
enableUtf8: tl.getBoolInput("enableUtf8", false),
203205
customCmds: tl.getDelimitedInput("customCmds", "\n", false)
206+
204207
};
205208
}
206209

207210
function getAccessOption(options: FtpOptions): ftp.AccessOptions {
208211
const protocol = options.serverEndpointUrl.protocol;
209-
const secure: boolean = protocol != undefined ? protocol.toLowerCase() === "ftps:" : false;
212+
let secure: boolean | "implicit";
213+
if (options.implicitFTPS) {
214+
secure = "implicit";
215+
}
216+
else {
217+
secure = !!protocol && protocol.toLowerCase() === "ftps:";
218+
}
219+
210220
const secureOptions: any = { rejectUnauthorized: !options.trustSSL };
211221

212222
const hostName: string = options.serverEndpointUrl.hostname!;

Tasks/FtpUploadV2/task.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"demands": [],
1919
"version": {
2020
"Major": 2,
21-
"Minor": 211,
21+
"Minor": 228,
2222
"Patch": 0
2323
},
2424
"minimumAgentVersion": "2.182.1",
@@ -79,6 +79,13 @@
7979
"required": true,
8080
"visibleRule": "credsType = inputs"
8181
},
82+
{
83+
"name": "implicitFTPS",
84+
"type": "boolean",
85+
"label": "Use implicit FTPS",
86+
"defaultValue": "false",
87+
"required": false
88+
},
8289
{
8390
"name": "rootFolder",
8491
"aliases": [
@@ -208,4 +215,4 @@
208215
"UploadSucceedRes": "FTP upload successful",
209216
"UploadFailed": "Ftp Upload failed"
210217
}
211-
}
218+
}

Tasks/FtpUploadV2/task.loc.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"demands": [],
1919
"version": {
2020
"Major": 2,
21-
"Minor": 211,
21+
"Minor": 228,
2222
"Patch": 0
2323
},
2424
"minimumAgentVersion": "2.182.1",
@@ -79,6 +79,13 @@
7979
"required": true,
8080
"visibleRule": "credsType = inputs"
8181
},
82+
{
83+
"name": "implicitFTPS",
84+
"type": "boolean",
85+
"label": "ms-resource:loc.input.label.implicitFTPS",
86+
"defaultValue": "false",
87+
"required": false
88+
},
8289
{
8390
"name": "rootFolder",
8491
"aliases": [

0 commit comments

Comments
 (0)