Replace invalid characters with underscore instead of removing them

Co-authored-by: TingluoHuang <1750815+TingluoHuang@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-01-06 22:39:03 +00:00
parent 8a9be95424
commit 135f4fc944
3 changed files with 25 additions and 7 deletions

View File

@@ -111,8 +111,8 @@ function getUserAgentWithOrchestrationId(userAgent: string): string {
return userAgent
}
// Sanitize orchestration ID - only keep alphanumeric, dots, hyphens, and underscores
const sanitized = orchestrationId.replace(/[^a-zA-Z0-9._-]/g, '')
// Sanitize orchestration ID - replace invalid characters with underscore
const sanitized = orchestrationId.replace(/[^a-zA-Z0-9._-]/g, '_')
if (!sanitized) {
return userAgent
}