hlsts: prefix playlist segment URLs with ./ so colon-named files resolve

PathEscape leaves ':' alone, so a segment named movie:1.ts parses as
scheme 'movie' and players never resolve it against the playlist URL.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
user.emailandDevin committed 2026-10-24 10:03:29 -07:00
1 parent 428af1c0eb
commit e604b19d9d
2 files changed
+4 -4

No files matched your search

+1 -1
View File
@@ -281,7 +281,7 @@ func renderPlaylist(name string, info *playlistInfo, jwt string) []byte {
}
for i, durationMs := range info.DurationsMs {
fmt.Fprintf(&out, "#EXTINF:%.3f,\n", float64(durationMs)/1000)
fmt.Fprintf(&out, "%s?%s=%s&seq=%d%s\n", escapedName, format.ViewParam, FormatName, int64(i)+info.MediaSequence, credential)
fmt.Fprintf(&out, "./%s?%s=%s&seq=%d%s\n", escapedName, format.ViewParam, FormatName, int64(i)+info.MediaSequence, credential)
}
out.WriteString("#EXT-X-ENDLIST\n")
return []byte(out.String())
+3 -3
View File
@@ -121,11 +121,11 @@ func TestViewPlaylist(t *testing.T) {
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-PLAYLIST-TYPE:VOD
#EXTINF:6.000,
movie.ts?format.view=hls-ts&seq=0
./movie.ts?format.view=hls-ts&seq=0
#EXTINF:6.000,
movie.ts?format.view=hls-ts&seq=1
./movie.ts?format.view=hls-ts&seq=1
#EXTINF:2.500,
movie.ts?format.view=hls-ts&seq=2
./movie.ts?format.view=hls-ts&seq=2
#EXT-X-ENDLIST
`
if string(plan.Body) != want {