From b81836a248209f4b7c6a619e301a5bc52962f210 Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Thu, 15 Apr 2021 13:57:21 +0300 Subject: [PATCH] Fix index.js --- dist/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 15f8a3b..6ef97ad 100644 --- a/dist/index.js +++ b/dist/index.js @@ -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)