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

4
dist/index.js vendored
View File

@@ -36325,8 +36325,8 @@ function getUserAgentWithOrchestrationId(userAgent) {
if (!orchestrationId) {
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;
}