mirror of
https://github.com/actions/github-script.git
synced 2026-04-07 14:49:25 +00:00
Replace invalid characters with underscore instead of removing them
Co-authored-by: TingluoHuang <1750815+TingluoHuang@users.noreply.github.com>
This commit is contained in:
parent
8a9be95424
commit
135f4fc944
3 changed files with 25 additions and 7 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue