mirror of
https://github.com/actions/runner.git
synced 2025-12-13 00:36:29 +00:00
Replace '(' and ')' with '[' and '] from OS.Description so it doesn't fail User-Agent header validation (#2288)
* Sanitize OS Desc for UserAgents * Only drop brackets if needed, refactoring * Add missing ')' * Readd missing brackets around '(header)' * Add comments * Use bracket solution from SDK * Rename tests
This commit is contained in:
@@ -73,7 +73,7 @@ namespace GitHub.Runner.Sdk
|
||||
{
|
||||
var headerValues = new List<ProductInfoHeaderValue>();
|
||||
headerValues.Add(new ProductInfoHeaderValue($"GitHubActionsRunner-Plugin", BuildConstants.RunnerPackage.Version));
|
||||
headerValues.Add(new ProductInfoHeaderValue($"({RuntimeInformation.OSDescription.Trim()})"));
|
||||
headerValues.Add(new ProductInfoHeaderValue($"({StringUtil.SanitizeUserAgentHeader(RuntimeInformation.OSDescription)})"));
|
||||
|
||||
if (VssClientHttpRequestSettings.Default.UserAgent != null && VssClientHttpRequestSettings.Default.UserAgent.Count > 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user