fix <controlURL>_urn:schemas-upnp-org:service:AVTransport_control</controlURL> throw error first path segment in URL cannot contain colon

This commit is contained in:
humboldt_xie
2021-09-08 08:10:00 +01:00
committed by Huin
parent 5a0d4bd7ee
commit aaf1a9757f
+6
View File
@@ -7,6 +7,7 @@ import (
"errors"
"fmt"
"net/url"
"strings"
"github.com/huin/goupnp/scpd"
"github.com/huin/goupnp/soap"
@@ -178,6 +179,11 @@ type URLField struct {
}
func (uf *URLField) SetURLBase(urlBase *url.URL) {
str := uf.Str
if !strings.Contains(str, "://") && !strings.HasPrefix(str, "/") {
str = "/" + str
}
refUrl, err := url.Parse(uf.Str)
if err != nil {
uf.URL = url.URL{}