fix(deeplink): preserve custom env fields when importing Claude providers#266
Open
thedavidweng wants to merge 2 commits into
Open
fix(deeplink): preserve custom env fields when importing Claude providers#266thedavidweng wants to merge 2 commits into
thedavidweng wants to merge 2 commits into
Conversation
…ders When importing Claude providers through deeplinks, custom environment variables (e.g. ANTHROPIC_CUSTOM_HEADERS, proxy settings) were silently dropped because build_claude_settings constructed env from scratch with only known keys. - Add custom_env field to DeepLinkImportRequest to carry unknown env keys - In merge_claude_config, collect non-standard env keys into custom_env - In build_claude_settings, merge custom_env into the output env object Closes SaladDay#261
The PR added custom_env to the struct definition and provider.rs usage but missed updating the parser constructor, causing a compile error.
32e4152 to
7b5e59d
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.
Summary
When importing Claude providers through deeplinks (
ccswitch://v1/import?...), custom environment variables were silently dropped.build_claude_settingsconstructed env from scratch with only known keys (ANTHROPIC_AUTH_TOKEN,ANTHROPIC_BASE_URL, model keys), discarding any user-defined variables likeANTHROPIC_CUSTOM_HEADERSor proxy settings.The CLI/TUI provider creation path already preserved these fields by cloning existing settings — this fix brings the deeplink import path to parity.
Changes
src-tauri/src/deeplink/mod.rscustom_env: Option<Map<String, Value>>field toDeepLinkImportRequestsrc-tauri/src/deeplink/provider.rsmerge_claude_config: collect non-standard env keys intocustom_envbuild_claude_settings: mergecustom_enventries into the output envCloses #261