From ce264289b275016a23f910aaa2c7dbe2c64ede6d Mon Sep 17 00:00:00 2001 From: sato Date: Tue, 24 Dec 2024 16:30:50 +0800 Subject: [PATCH 1/2] fix: empty u.path, cause 'panic: runtime error: slice bounds out of range [1:0]' --- server_session.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server_session.go b/server_session.go index 5fb49503..1314a0da 100644 --- a/server_session.go +++ b/server_session.go @@ -71,6 +71,10 @@ func getPathAndQueryAndTrackID(u *base.URL) (string, string, string, error) { return path, query, trackID, nil } + if u.Path == "" { + return "", "", "", liberrors.ErrServerPathNoSlash{} + } + // no track ID and a trailing slash. // this happens when trying to read a MPEG-TS stream with FFmpeg. if strings.HasSuffix(u.RawQuery, "/") { From edd1a1cb2a20d4045fda1d81fc91832bd9ee4d62 Mon Sep 17 00:00:00 2001 From: saint Date: Tue, 24 Dec 2024 16:40:26 +0800 Subject: [PATCH 2/2] format server_session.go --- server_session.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server_session.go b/server_session.go index 1314a0da..41fccb30 100644 --- a/server_session.go +++ b/server_session.go @@ -71,9 +71,9 @@ func getPathAndQueryAndTrackID(u *base.URL) (string, string, string, error) { return path, query, trackID, nil } - if u.Path == "" { - return "", "", "", liberrors.ErrServerPathNoSlash{} - } + if u.Path == "" { + return "", "", "", liberrors.ErrServerPathNoSlash{} + } // no track ID and a trailing slash. // this happens when trying to read a MPEG-TS stream with FFmpeg.