mirror of
https://github.com/vxcontrol/pentagi.git
synced 2026-07-20 23:57:11 -04:00
[PR #127] [MERGED] fix: add missing return after error in OAuth callback redirect #176
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/vxcontrol/pentagi/pull/127
Author: @mason5052
Created: 2/22/2026
Status: ✅ Merged
Merged: 2/23/2026
Merged by: @asdek
Base:
feature/project_improvements← Head:fix/oauth-callback-missing-return📝 Commits (1)
cb654cefix: add missing return after error in OAuth callback redirect📊 Changes
1 file changed (+1 additions, -0 deletions)
View changed files
📝
backend/pkg/server/services/auth.go(+1 -0)📄 Description
Description of the Change
Problem
In
authLoginCallback(), whenurl.Parse(returnURI)fails,response.Success(c, http.StatusOK, nil)writes a 200 OK response but execution falls through to line 592-595 which callshttp.Redirect(), attempting to write a second response (303 See Other). This causes a "superfluous response.WriteHeader call" warning and undefined behavior from the double response write.Solution
Add the missing
returnstatement afterresponse.Success()in the error branch to prevent execution from falling through to the redirect logic.Ref: #101
Type of Change
Areas Affected
Testing and Verification
Test Steps
cd backend && go build ./...return_uriin state dataSecurity Considerations
Without the
return, a malformedreturn_uricould cause unpredictable HTTP response behavior. The fix ensures clean error handling in the OAuth callback flow.Checklist
Code Quality
go fmtandgo vet(for Go code)Security
Compatibility
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.