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