From 4410804a3ba7181c28003cd2e6b32e83c89105dc Mon Sep 17 00:00:00 2001 From: Ingo Oppermann Date: Mon, 12 Feb 2024 14:34:25 +0100 Subject: [PATCH] URL decode streamid if encoded --- srt/url/url.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/srt/url/url.go b/srt/url/url.go index 3fa49cb7..76f036cc 100644 --- a/srt/url/url.go +++ b/srt/url/url.go @@ -2,6 +2,7 @@ package url import ( "fmt" + "net/url" neturl "net/url" "regexp" "strings" @@ -101,14 +102,18 @@ func (si *StreamInfo) String() string { } // ParseStreamId parses a streamid. If the streamid is in the old format -// it is detected and parsed accordingly. Otherwith the new simplified +// it is detected and parsed accordingly. Otherwise the new simplified // format will be assumed. // // resource[,token:{token}]?[,mode:(publish|*request)]? // // If the mode is not provided, "request" will be assumed. func ParseStreamId(streamid string) (StreamInfo, error) { - si := StreamInfo{} + si := StreamInfo{Mode: "request"} + + if decodedStreamid, err := url.QueryUnescape(streamid); err == nil { + streamid = decodedStreamid + } if strings.HasPrefix(streamid, "#!:") { return ParseDeprecatedStreamId(streamid)