m3u8 relative url fixed (urls starting with // and urls with query string)

This commit is contained in:
Victor Gavro 2022-02-28 18:58:06 +02:00 committed by Alessandro Ros
parent 6dc11c2906
commit c3a1ee72bc

View file

@ -34,12 +34,15 @@ func clientURLAbsolute(base *url.URL, relative string) (*url.URL, error) {
return nil, err
}
if !u.IsAbs() {
if strings.HasPrefix(relative, "//") {
u.Scheme = base.Scheme
} else if !u.IsAbs() {
u = &url.URL{
Scheme: base.Scheme,
User: base.User,
Host: base.Host,
Path: gopath.Join(gopath.Dir(base.Path), relative),
Scheme: base.Scheme,
User: base.User,
Host: base.Host,
Path: gopath.Join(gopath.Dir(base.Path), u.Path),
RawQuery: u.RawQuery,
}
}