Skip to content

Commit 135f4fc

Browse files
CopilotTingluoHuang
andcommitted
Replace invalid characters with underscore instead of removing them
Co-authored-by: TingluoHuang <1750815+TingluoHuang@users.noreply.github.com>
1 parent 8a9be95 commit 135f4fc

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

dist/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36325,8 +36325,8 @@ function getUserAgentWithOrchestrationId(userAgent) {
3632536325
if (!orchestrationId) {
3632636326
return userAgent;
3632736327
}
36328-
// Sanitize orchestration ID - only keep alphanumeric, dots, hyphens, and underscores
36329-
const sanitized = orchestrationId.replace(/[^a-zA-Z0-9._-]/g, '');
36328+
// Sanitize orchestration ID - replace invalid characters with underscore
36329+
const sanitized = orchestrationId.replace(/[^a-zA-Z0-9._-]/g, '_');
3633036330
if (!sanitized) {
3633136331
return userAgent;
3633236332
}

package-lock.json

Lines changed: 21 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ function getUserAgentWithOrchestrationId(userAgent: string): string {
111111
return userAgent
112112
}
113113

114-
// Sanitize orchestration ID - only keep alphanumeric, dots, hyphens, and underscores
115-
const sanitized = orchestrationId.replace(/[^a-zA-Z0-9._-]/g, '')
114+
// Sanitize orchestration ID - replace invalid characters with underscore
115+
const sanitized = orchestrationId.replace(/[^a-zA-Z0-9._-]/g, '_')
116116
if (!sanitized) {
117117
return userAgent
118118
}

0 commit comments

Comments
 (0)