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

Fixed a bug when an error occurred when using implicit FTPS (FTP over TLS). #18908

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 != undefined ? protocol.toLowerCase() === "ftps:" : false;
DenisNikulin5 marked this conversation as resolved.
Show resolved Hide resolved
}

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