mirror of
https://github.com/actions/checkout.git
synced 2026-01-20 07:38:53 +08:00
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:
parent
dbf1fa69f1
commit
4b8779770e
3 changed files with 74 additions and 8 deletions
|
|
@ -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}`
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue