fix(config): strip UTF-8 BOM from relay config file input#1314
Merged
Conversation
When a config file starts with UTF-8 BOM (\u{feff}), the BOM character
was not stripped before parsing, causing root_key_value() to fail
matching 'model_provider' (it matched '\u{feff}model_provider' instead).
This made relay_config_status_from_home() report configured=false.
Fix: strip the BOM prefix before processing in apply_relay_config_file_to_home.
cd14a4b to
ce9f9db
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
当 config.toml 以 UTF-8 BOM (
\u{feff}) 开头时,relay_config_status_from_home()报告configured=false。根因
root_key_value()行解析时trim()不去掉 BOM(BOM 不是 ASCII 空白),导致第一行解析为\u{feff}model_provider = "custom"而非model_provider = "custom",匹配失败。修复
在
apply_relay_config_file_to_home()入口处 strip BOM 前缀。验证
apply_relay_config_file_accepts_utf8_bom_config测试通过 ✅