mirror of
https://github.com/actions/setup-dotnet.git
synced 2024-11-22 19:41:08 +07:00
Improve key names validation for keys from user nuget config
This commit is contained in:
parent
5a201f5e82
commit
56d96e897e
@ -25,6 +25,12 @@ export function configAuthentication(
|
|||||||
writeFeedToFile(feedUrl, existingNuGetConfig, tempNuGetConfig);
|
writeFeedToFile(feedUrl, existingNuGetConfig, tempNuGetConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isValidKey(
|
||||||
|
key: string
|
||||||
|
): boolean {
|
||||||
|
return /^[0-9\w\-\_\.]+$/i.test(key);
|
||||||
|
}
|
||||||
|
|
||||||
function writeFeedToFile(
|
function writeFeedToFile(
|
||||||
feedUrl: string,
|
feedUrl: string,
|
||||||
existingFileLocation: string,
|
existingFileLocation: string,
|
||||||
@ -109,9 +115,9 @@ function writeFeedToFile(
|
|||||||
xml = xml.ele('packageSourceCredentials');
|
xml = xml.ele('packageSourceCredentials');
|
||||||
|
|
||||||
sourceKeys.forEach(key => {
|
sourceKeys.forEach(key => {
|
||||||
if (key.indexOf(' ') > -1) {
|
if (!isValidKey(key)) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
"This action currently can't handle source names with spaces. Remove the space from your repo's NuGet.config and try again."
|
"Source name can contain letters, numbers, and '-', '_', '.' symbols only, Please, fix source name in NuGet.config and try again."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user