Improve tests to verify user-agent content and handle empty sanitized IDs

Co-authored-by: TingluoHuang <1750815+TingluoHuang@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-01-08 15:39:33 +00:00
parent dbf1fa69f1
commit 4b8779770e
3 changed files with 74 additions and 8 deletions

View file

@ -738,7 +738,8 @@ class GitCommandManager {
// Sanitize the orchestration ID to ensure it contains only valid characters
// Valid characters: 0-9, a-z, _, -, .
const sanitizedId = orchId.replace(/[^a-z0-9_.-]/gi, '_')
if (sanitizedId.trim().length > 0) {
// Only append if sanitized ID contains at least one alphanumeric character
if (sanitizedId && /[a-z0-9]/i.test(sanitizedId)) {
gitHttpUserAgent = `${gitHttpUserAgent} actions_orchestration_id/${sanitizedId}`
}
}