mirror of
https://github.com/actions/runner.git
synced 2025-12-11 04:46:58 +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:
@@ -19,7 +19,7 @@ namespace GitHub.Runner.Sdk
|
||||
{
|
||||
var headerValues = new List<ProductInfoHeaderValue>();
|
||||
headerValues.AddRange(additionalUserAgents);
|
||||
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