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-08-10 01:25:57 +08:00 committed by Huin
parent 5a0d4bd7ee
commit aaf1a9757f

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{}