Fix onvif source: invalid control character in URL #662

This commit is contained in:
Alex X
2023-10-11 13:43:45 +03:00
parent 3ae15d8f80
commit 2e9f3181d4
3 changed files with 205 additions and 5 deletions
+5 -4
View File
@@ -5,7 +5,6 @@ import (
"crypto/sha1"
"encoding/base64"
"errors"
"github.com/AlexxIT/go2rtc/pkg/core"
"html"
"io"
"net/http"
@@ -13,6 +12,8 @@ import (
"regexp"
"strings"
"time"
"github.com/AlexxIT/go2rtc/pkg/core"
)
const PathDevice = "/onvif/device_service"
@@ -78,10 +79,10 @@ func (c *Client) GetURI() (string, error) {
return "", err
}
uri := FindTagValue(b, "Uri")
uri = html.UnescapeString(uri)
rawURL := FindTagValue(b, "Uri")
rawURL = strings.TrimSpace(html.UnescapeString(rawURL))
u, err := url.Parse(uri)
u, err := url.Parse(rawURL)
if err != nil {
return "", err
}