mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-24 12:44:18 +08:00
e605eba292
When importing a Claude provider via deep link, the preview dialog correctly shows every env field carried in the `config` payload — but on confirmation `build_claude_settings` only persisted the standard fields mapped from URL params (`apiKey`, `endpoint`, `model`, `haiku/sonnet/opusModel`). Any non-standard env keys such as `ANTHROPIC_CUSTOM_HEADERS`, `API_TIMEOUT_MS`, or `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS` were silently dropped, making the preview and the actual write diverge. Start the env map from the inline `config` payload (best-effort decode via the new `extract_claude_config_env` helper) and then overlay the URL-param-derived standard fields on top, so: - URL params remain authoritative for standard fields (unchanged) - Custom env keys present in `config` survive the import - Deep links without a `config` payload behave exactly as before Adds two regression tests: - `test_build_claude_provider_preserves_custom_env_fields` proves custom fields are kept and URL params override same-named config fields. - `test_build_claude_provider_without_config_unchanged` guards the backward-compatible path (no `config` → only standard env keys). Closes #2927 Co-authored-by: lipeng31 <lipeng31@tanyang.co>