mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #3609] [MERGED] fix: handle GitHub API error responses in GetXrayVersions #5483
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#5483
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/3609
Author: @qzydustin
Created: 12/26/2025
Status: ✅ Merged
Merged: 1/2/2026
Merged by: @MHSanaei
Base:
main← Head:main📝 Commits (1)
cc3e6d4fix: handle GitHub API error responses in GetXrayVersions📊 Changes
1 file changed (+12 additions, -0 deletions)
View changed files
📝
web/service/server.go(+12 -0)📄 Description
GitHub API returns JSON object instead of array when encountering errors (e.g., rate limit exceeded). This causes JSON unmarshal error: 'cannot unmarshal object into Go value of type []service.Release'
Add HTTP status code check to handle error responses gracefully and return user-friendly error messages instead of JSON parsing errors.
Fixes issue where getXrayVersion fails with unmarshal error when GitHub API rate limit is exceeded.
What is the pull request?
This PR fixes a bug in
GetXrayVersions()function where GitHub API error responses (e.g., rate limit exceeded) cause JSON unmarshal errors. When GitHub API returns an error (status code 403, etc.), it returns a JSON object instead of an array, causing the code to fail with "cannot unmarshal object into Go value of type []service.Release".The fix adds HTTP status code validation before parsing the response. When a non-200 status is detected, the code now reads and parses the error message from the response body, returning a user-friendly error message instead of a JSON parsing error.
Which part of the application is affected by the change?
Type of Changes
Screenshots
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.