Fix index.js

This commit is contained in:
Vladimir Safonkin 2021-04-15 13:57:21 +03:00
parent 3b539379a8
commit b81836a248

7
dist/index.js vendored
View File

@ -4845,6 +4845,9 @@ function configAuthentication(feedUrl, existingFileLocation = '', processRoot =
writeFeedToFile(feedUrl, existingNuGetConfig, tempNuGetConfig);
}
exports.configAuthentication = configAuthentication;
function isValidKey(key) {
return /^[\w\-\.]+$/i.test(key);
}
function writeFeedToFile(feedUrl, existingFileLocation, tempFileLocation) {
console.log(`dotnet-auth: Finding any source references in ${existingFileLocation}, writing a new temporary configuration file with credentials to ${tempFileLocation}`);
let xml;
@ -4910,8 +4913,8 @@ function writeFeedToFile(feedUrl, existingFileLocation, tempFileLocation) {
}
xml = xml.ele('packageSourceCredentials');
sourceKeys.forEach(key => {
if (key.indexOf(' ') > -1) {
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.");
if (!isValidKey(key)) {
throw new Error("Source name can contain letters, numbers, and '-', '_', '.' symbols only. Please, fix source name in NuGet.config and try again.");
}
xml = xml
.ele(key)