Fix m3u url path by escaping it (#18)

Signed-off-by: Pierre-Emmanuel Jacquier <pierre-emmanuel.jacquier@exoscale.ch>
This commit is contained in:
Pierre-Emmanuel Jacquier
2019-10-30 10:46:26 +01:00
committed by GitHub
parent 8795338f54
commit c515ebb741
2 changed files with 7 additions and 7 deletions

View File

@@ -13,7 +13,7 @@ func Marshall(p *m3u.Playlist) (string, error) {
result := "#EXTM3U\n"
for _, track := range p.Tracks {
result += "#EXTINF:"
result += fmt.Sprintf("%d ", track.Length)
result += fmt.Sprintf("%d, ", track.Length)
for i := range track.Tags {
if i == len(track.Tags)-1 {
result += fmt.Sprintf("%s=%q,", track.Tags[i].Name, track.Tags[i].Value)
@@ -46,9 +46,9 @@ func ReplaceURL(playlist *m3u.Playlist, user, password string, hostConfig *confi
protocol,
hostConfig.Hostname,
hostConfig.Port,
oriURL.Path,
user,
password,
oriURL.EscapedPath(),
url.QueryEscape(user),
url.QueryEscape(password),
)
destURL, err := url.Parse(uri)
if err != nil {

View File

@@ -298,9 +298,9 @@ func xtreamReplaceURL(playlist *m3u.Playlist, user, password string, hostConfig
protocol,
hostConfig.Hostname,
hostConfig.Port,
user,
password,
id,
url.QueryEscape(user),
url.QueryEscape(password),
url.QueryEscape(id),
)
destURL, err := url.Parse(uri)
if err != nil {