Skip to content

fix(deeplink): preserve custom env fields when importing Claude providers#266

Open
thedavidweng wants to merge 2 commits into
SaladDay:mainfrom
thedavidweng:fix/261-deeplink-preserve-custom-env-fields
Open

fix(deeplink): preserve custom env fields when importing Claude providers#266
thedavidweng wants to merge 2 commits into
SaladDay:mainfrom
thedavidweng:fix/261-deeplink-preserve-custom-env-fields

Conversation

@thedavidweng

Copy link
Copy Markdown
Contributor

Summary

When importing Claude providers through deeplinks (ccswitch://v1/import?...), custom environment variables were silently dropped. build_claude_settings constructed env from scratch with only known keys (ANTHROPIC_AUTH_TOKEN, ANTHROPIC_BASE_URL, model keys), discarding any user-defined variables like ANTHROPIC_CUSTOM_HEADERS or 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.rs

  • Add custom_env: Option<Map<String, Value>> field to DeepLinkImportRequest

src-tauri/src/deeplink/provider.rs

  • In merge_claude_config: collect non-standard env keys into custom_env
  • In build_claude_settings: merge custom_env entries into the output env

Closes #261

@thedavidweng thedavidweng marked this pull request as ready for review June 10, 2026 03:15
…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.
@thedavidweng thedavidweng force-pushed the fix/261-deeplink-preserve-custom-env-fields branch from 32e4152 to 7b5e59d Compare June 10, 2026 21:17
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.

fix(deeplink): custom env fields lost when importing Claude providers

1 participant