Fix extra slash for RTSP SETUP #1236

This commit is contained in:
Alex X
2025-03-09 17:08:25 +03:00
parent b6934922fa
commit 3954a555f8
2 changed files with 3 additions and 4 deletions
+2 -4
View File
@@ -237,13 +237,11 @@ func (c *Conn) SetupMedia(media *core.Media) (byte, error) {
rawURL := media.ID // control
if !strings.Contains(rawURL, "://") {
rawURL = c.URL.String()
if !strings.HasSuffix(rawURL, "/") {
// prefix check for https://github.com/AlexxIT/go2rtc/issues/1236
if !strings.HasSuffix(rawURL, "/") && !strings.HasPrefix(media.ID, "/") {
rawURL += "/"
}
rawURL += media.ID
} else if strings.HasPrefix(rawURL, "rtsp://rtsp://") {
// fix https://github.com/AlexxIT/go2rtc/issues/830
rawURL = rawURL[7:]
}
trackURL, err := urlParse(rawURL)
if err != nil {