mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #3990] [MERGED] fix(sub): use safe type assertion for xhttp mode field #5576
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#5576
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
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/MHSanaei/3x-ui/pull/3990
Author: @nnemirovsky
Created: 4/2/2026
Status: ✅ Merged
Merged: 4/19/2026
Merged by: @MHSanaei
Base:
main← Head:fix/xhttp-subscription-panic📝 Commits (1)
b112f4ffix(sub): use safe type assertion for xhttp mode field📊 Changes
1 file changed (+4 additions, -4 deletions)
View changed files
📝
sub/subService.go(+4 -4)📄 Description
Summary
Fix HTTP 500 on subscription endpoint for XHTTP/SplitHTTP inbounds.
Unsafe type assertion
xhttp["mode"].(string)panics whenmodeis nil (key absent from stored JSON). This happens whenxhttpSettingsonly containspathwithout an explicitmodefield. The panic is caught by Gin's recovery middleware and returned as HTTP 500 with an empty body. The error is invisible in logs because the subscription server setsgin.DefaultErrorWriter = io.Discard.Fix
Change all 4 occurrences from unsafe assertion to comma-ok pattern:
This matches the fix already applied to gRPC's
authorityfield in commit21d98813.Affected functions
genVmessLink(line 250)genVlessLink(line 408)genTrojanLink(line 604)genShadowsocksLink(line 803)Fixes #3987
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.