From aaf1a9757f76a4e3a76d1c1688c2f6bf7b5100e5 Mon Sep 17 00:00:00 2001 From: humboldt_xie Date: Tue, 10 Aug 2021 01:25:57 +0800 Subject: [PATCH] fix _urn:schemas-upnp-org:service:AVTransport_control throw error first path segment in URL cannot contain colon --- device.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/device.go b/device.go index 567ab4c..5dc5f91 100644 --- a/device.go +++ b/device.go @@ -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{}