Fix panic when .netrc entry has no password#4444
Closed
aviu16 wants to merge 1 commit intoTabbyML:mainfrom
Closed
Conversation
When a .netrc entry has no password field, machine.password is None and unwrapping it causes a panic. Changed to use if-let to only update password if it exists. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Author
|
gonna close this one, realized i dont have bandwidth to follow up on review feedback rn. sorry about that! |
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
Fixes a panic in
get_credentials_from_netrcwhen a .netrc entry exists but has no password field.Bug Description
In
crates/aim-downloader/src/address.rs, theget_credentials_from_netrcfunction unconditionally unwrapsmachine.password:Crash Scenario
A .netrc file like this will cause a panic:
When tabby tries to download from
example.com, it finds the matching host in .netrc, butmachine.passwordisNonebecause no password was specified. The.unwrap()then panics.Root Cause
The netrc crate's
Machinestruct haspassword: Option<String>, but the code assumes it's alwaysSome.Fix
Changed to use
if letto only update the password if it exists:If no password is in .netrc, the function now falls back to the
passwordparameter (default:"anonymous").Impact
loginis handled (which doesn't unwrap since it's notOption<String>)Testing
The fix allows .netrc files with password-less entries to work without crashing. The existing test cases continue to pass.
🤖 Generated with Claude Code