diff --git a/server/torr/stream.go b/server/torr/stream.go index 3d35cd0..8817178 100644 --- a/server/torr/stream.go +++ b/server/torr/stream.go @@ -62,7 +62,8 @@ func (t *Torrent) Stream(fileID int, req *http.Request, resp http.ResponseWriter sets.SetViewed(&sets.Viewed{t.Hash().HexString(), fileID}) resp.Header().Set("Connection", "close") - resp.Header().Set("ETag", httptoo.EncodeQuotedString(fmt.Sprintf("%s/%s", t.Hash().HexString(), hex.EncodeToString([]byte(file.Path()))))) + etag := hex.EncodeToString([]byte(fmt.Sprintf("%s/%s", t.Hash().HexString(), file.Path()))) + resp.Header().Set("ETag", httptoo.EncodeQuotedString(etag)) // DLNA headers resp.Header().Set("transferMode.dlna.org", "Streaming") mime, err := mt.MimeTypeByPath(file.Path()) diff --git a/server/web/api/m3u.go b/server/web/api/m3u.go index 7dd6b57..afce025 100644 --- a/server/web/api/m3u.go +++ b/server/web/api/m3u.go @@ -73,7 +73,8 @@ func sendM3U(c *gin.Context, name, hash string, m3u string) { c.Header("Content-Type", "audio/x-mpegurl") c.Header("Connection", "close") if hash != "" { - c.Header("ETag", httptoo.EncodeQuotedString(fmt.Sprintf("%s/%s", hash, hex.EncodeToString([]byte(name))))) + etag := hex.EncodeToString([]byte(fmt.Sprintf("%s/%s", hash, name))) + c.Header("ETag", httptoo.EncodeQuotedString(etag)) } if name == "" { name = "playlist.m3u"