Repository navigation
fix(config): accept Windows interface names - #154
Merged
Merged
Conversation
On Windows the interface list shows each adapter's display name (`以太网`, `vEthernet (Default Switch)`, `WLAN 2`), chosen over the GUID so people can tell them apart. The bind parser still judged names by the Unix rule (short ASCII kernel names like en0), so on a real Windows install every interface in the list was rejected on save. The shape check is now per platform: on Windows, a name only has to be non-empty, free of control characters and surrounding whitespace, and at most 256 characters. The Unix rule is unchanged. Both rules are tested on any host, and a name with spaces, parentheses or Chinese survives being written into the configuration and read back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`192.168.1.5@wifi` is a valid Windows interface name now; a control character is not a name on either platform (and survives the trim). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
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.
Found on a real Windows install of ThinkWatch Lite 2026.9.11: choosing "LAN" in the listen settings and saving fails with
bind takes loopback, all, the name of an interface such as en0, …; it reads 以太网(same forvEthernet (Default Switch)).On Windows the interface list (
nics.rs) deliberately uses the adapter's display name rather than its GUID.looks_like_nicstill applied the Unix kernel-name rule (ASCII,.-_, under 16 bytes), so every Windows interface was rejected.nic_shape(windows, s): on Windows a name only has to be non-empty, have no control characters or surrounding whitespace, and be at most 256 characters; the Unix rule is unchanged. It takes the platform as a parameter so both rules are tested on any host.a_bind_typo_says_what_the_forms_areused192.168.1.5@wifi, which is now a valid Windows name; it uses a value with a leading space, rejected on both.edit::set(the path the UI's save uses) and read back unchanged; on Windows they parse asBind::Nic.cargo fmt --check,cargo clippy --all-targets -D warnings,cargo test --workspacepass on macOS; the Windows job runs the Windows side.🤖 Generated with Claude Code