Sanitize extension name to match vscode sudo prompt name requirements

This commit is contained in:
Noah Gilson 2024-01-03 11:32:41 -08:00
Родитель 058f56ec4c
Коммит 83d2d7d8ef
1 изменённых файлов: 3 добавлений и 1 удалений

Просмотреть файл

@ -86,7 +86,9 @@ Please install the .NET SDK manually by following https://learn.microsoft.com/en
return new Promise<string>((resolve, reject) =>
{
// The '.' character is not allowed for sudo-prompt so we use 'NET'
const options = { name: `${this.context?.acquisitionContext?.requestingExtensionId} On behalf of NET Install Tool` };
let sanitizedCallerName = this.context?.acquisitionContext?.requestingExtensionId?.replace(/[^0-9a-z]/gi, ''); // Remove non-alphanumerics per OS requirements
sanitizedCallerName = sanitizedCallerName?.substring(0, 69); // 70 Characters is the maximum limit we can use for the prompt.
const options = { name: `${sanitizedCallerName ?? '.NET Install Tool'}` };
exec((fullCommandString), options, (error?: any, stdout?: any, stderr?: any) =>
{
let commandResultString = '';