Skip to content

fix: use safe_substitute to prevent crash on dollar signs in config values (fixes #2349)#2377

Open
hanhan761 wants to merge 1 commit into
microsoft:mainfrom
hanhan761:fix-2349-config-dollar-sign
Open

fix: use safe_substitute to prevent crash on dollar signs in config values (fixes #2349)#2377
hanhan761 wants to merge 1 commit into
microsoft:mainfrom
hanhan761:fix-2349-config-dollar-sign

Conversation

@hanhan761
Copy link
Copy Markdown

The config loader uses string.Template.substitute() to process environment variables in settings.yaml. However, substitute() treats every dollar sign character as a placeholder prefix, causing a hard crash with ValueError when dollar signs appear in regex patterns like file_pattern.

Replaced substitute() with safe_substitute(), which silently leaves unrecognized placeholders as literal text instead of raising an error. Environment variable substitution still works correctly.

Fixes #2349

@hanhan761 hanhan761 requested a review from a team as a code owner May 30, 2026 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: string.Template.substitute() crashes on $ in config values like regex file_pattern

1 participant