fix: return error when ValidateJiraToken receives malformed URL#1186
Open
ambient-code[bot] wants to merge 1 commit intomainfrom
Open
fix: return error when ValidateJiraToken receives malformed URL#1186ambient-code[bot] wants to merge 1 commit intomainfrom
ambient-code[bot] wants to merge 1 commit intomainfrom
Conversation
When http.NewRequestWithContext fails for all Jira API URL candidates (e.g. malformed URL), the loop silently swallowed every error via continue. Because sawHTTPResponse and lastNetErr were never set, the function fell through to return true, nil — falsely reporting a broken Jira URL as a valid connection. Capture the request-construction error in lastReqErr and check it in the fallthrough path so malformed URLs correctly return false + error. Closes #1079 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
ValidateJiraTokensilently returningtrue, nilwhen all Jira API URL candidates fail request construction (e.g. malformed URL)lastReqErrvariable to capture request-construction errors and check it in the fallthrough path://not-a-url) and assertsvalid == falseanderr != nilCloses #1079
Test plan
returns false with error for a malformed URL— passes malformed URL, assertsvalid == falseanderr != nilgo test -tags test ./handlers/)🤖 Generated with Claude Code