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

.netcoreinstaller improve error message when versionfile malformed #9387

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@
"loc.messages.WarningVersionNotFound": "Could not fetch download information for version %s. Please check if the version specified is correct. You can refer the link for supported versions => https://github.com/dotnet/core/blob/master/release-notes/releases.json. Falling back to creating convention based URL.",
"loc.messages.CouldNotDownload": "Could not download installation package from this URL: %s Error: %s",
"loc.messages.FailedToDownloadPackage": "Failed to download package for installation",
"loc.messages.PrependGlobalToolPath": "Creating global tool path and pre-prending to PATH."
"loc.messages.PrependGlobalToolPath": "Creating global tool path and pre-prending to PATH.",
"loc.messages.VersionsFileMalformed": "The specified version's download links are not correctly formed in the supported versions document => %s/"
}
5 changes: 4 additions & 1 deletion Tasks/DotNetCoreInstallerV0/releasesfetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ export class DotNetCoreReleaseFetcher {
let blobUrl: string = release['blob-' + type];
let dlcUrl: string = release['dlc-' + type];
let fileName: string = release[type + '-' + osSuffixes[0]] ? release[type + '-' + osSuffixes[0]] : release[type + '-' + osSuffixes[1]];
fileName = fileName.trim();

if (!!fileName) {
fileName = fileName.trim();
// For some latest version, the filename itself can be full download url.
// Do a very basic check for url(instead of regex) as the url is only for downloading and
// is coming from .net core releases json and not some ransom user input
Expand All @@ -47,6 +47,9 @@ export class DotNetCoreReleaseFetcher {
}
}
}
else {
throw taskLib.loc("VersionsFileMalformed", DotNetCoreReleasesUrl);
}
}
else {
console.log(taskLib.loc("WarningVersionNotFound", version));
Expand Down
5 changes: 3 additions & 2 deletions Tasks/DotNetCoreInstallerV0/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"version": {
"Major": 0,
"Minor": 2,
"Patch": 1
"Patch": 2
},
"satisfies": [
"DotNetCore"
Expand Down Expand Up @@ -69,6 +69,7 @@
"WarningVersionNotFound": "Could not fetch download information for version %s. Please check if the version specified is correct. You can refer the link for supported versions => https://github.com/dotnet/core/blob/master/release-notes/releases.json. Falling back to creating convention based URL.",
"CouldNotDownload": "Could not download installation package from this URL: %s Error: %s",
"FailedToDownloadPackage": "Failed to download package for installation",
"PrependGlobalToolPath": "Creating global tool path and pre-prending to PATH."
"PrependGlobalToolPath": "Creating global tool path and pre-prending to PATH.",
"VersionsFileMalformed": "The specified version's download links are not correctly formed in the supported versions document => %s/"
}
}
8 changes: 5 additions & 3 deletions Tasks/DotNetCoreInstallerV0/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"name": "DotNetCoreInstaller",
"friendlyName": "ms-resource:loc.friendlyName",
"description": "ms-resource:loc.description",
"helpUrl": "https://go.microsoft.com/fwlink/?linkid=853651",
"helpMarkDown": "ms-resource:loc.helpMarkDown",
"category": "Tool",
"runsOn": [
Expand All @@ -13,7 +14,7 @@
"version": {
"Major": 0,
"Minor": 2,
"Patch": 1
"Patch": 2
},
"satisfies": [
"DotNetCore"
Expand Down Expand Up @@ -68,6 +69,7 @@
"WarningVersionNotFound": "ms-resource:loc.messages.WarningVersionNotFound",
"CouldNotDownload": "ms-resource:loc.messages.CouldNotDownload",
"FailedToDownloadPackage": "ms-resource:loc.messages.FailedToDownloadPackage",
"PrependGlobalToolPath": "ms-resource:loc.messages.PrependGlobalToolPath"
"PrependGlobalToolPath": "ms-resource:loc.messages.PrependGlobalToolPath",
"VersionsFileMalformed": "ms-resource:loc.messages.VersionsFileMalformed"
}
}
}