Fix subscription user info header handling in SubHandler to only set header on successful fetch

This commit is contained in:
2025-06-26 10:55:21 +10:00
parent c1012750ff
commit 33d37e631b

View File

@ -27,11 +27,10 @@ func SubHandler(model M.ClashType, template string) func(c *gin.Context) {
if len(query.Subs) == 1 {
userInfoHeader, err := common.FetchSubscriptionUserInfo(query.Subs[0], "clash", config.GlobalConfig.RequestRetryTimes)
if err != nil {
c.String(http.StatusInternalServerError, err.Error())
}
if err == nil {
c.Header("subscription-userinfo", userInfoHeader)
}
}
if query.NodeListMode {
nodelist := M.NodeList{}