mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-06-05 12:44:22 +00:00
fix(sub): escape Clash subscription profile filename header
This commit is contained in:
parent
950a647bcc
commit
8a6c31ca39
1 changed files with 2 additions and 1 deletions
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
@ -279,7 +280,7 @@ func (a *SUBController) subClashs(c *gin.Context) {
|
||||||
a.ApplyCommonHeaders(c, header, a.updateInterval, a.subTitle, a.subSupportUrl, profileUrl, a.subAnnounce, a.subEnableRouting, a.subRoutingRules)
|
a.ApplyCommonHeaders(c, header, a.updateInterval, a.subTitle, a.subSupportUrl, profileUrl, a.subAnnounce, a.subEnableRouting, a.subRoutingRules)
|
||||||
if a.subTitle != "" {
|
if a.subTitle != "" {
|
||||||
// Clash clients commonly use Content-Disposition to choose the imported profile name.
|
// Clash clients commonly use Content-Disposition to choose the imported profile name.
|
||||||
c.Writer.Header().Set("Content-Disposition", fmt.Sprintf(`attachment; filename*=UTF-8''%s`, a.subTitle))
|
c.Writer.Header().Set("Content-Disposition", fmt.Sprintf(`attachment; filename*=UTF-8''%s`, url.PathEscape(a.subTitle)))
|
||||||
}
|
}
|
||||||
c.Data(200, "application/yaml; charset=utf-8", []byte(clashSub))
|
c.Data(200, "application/yaml; charset=utf-8", []byte(clashSub))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue