fix: harden playback and security edge cases

This commit is contained in:
ShukeBta
2026-06-25 02:33:30 +08:00
parent 02fe4fd374
commit 9021007027
5 changed files with 113 additions and 8 deletions
-5
View File
@@ -109,9 +109,6 @@ func proxyCloudResolvedLink(playback cloudPlaybackRequest) {
clientMethod = http.MethodGet
}
upstreamMethod := clientMethod
if upstreamMethod == http.MethodHead {
upstreamMethod = http.MethodGet
}
req, err := http.NewRequestWithContext(c.Request.Context(), upstreamMethod, playback.link.URL, nil)
if err != nil {
c.JSON(http.StatusBadGateway, gin.H{"error": err.Error()})
@@ -122,8 +119,6 @@ func proxyCloudResolvedLink(playback cloudPlaybackRequest) {
}
if rng := c.GetHeader("Range"); rng != "" {
req.Header.Set("Range", rng)
} else if clientMethod == http.MethodHead {
req.Header.Set("Range", "bytes=0-0")
}
if accept := c.GetHeader("Accept"); accept != "" {
req.Header.Set("Accept", accept)