mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
fix(announce): parse torrentUrl (#557)
fix(announce): generate torrentUrl
This commit is contained in:
parent
4623921cbb
commit
6ad4abe296
2 changed files with 51 additions and 3 deletions
|
@ -209,7 +209,8 @@ func (p *IndexerIRCParse) ParseMatch(baseURL string, vars map[string]string) (*I
|
|||
return nil, errors.New("could not write torrent url template output")
|
||||
}
|
||||
|
||||
parsedUrl, err := url.Parse(urlBytes.String())
|
||||
templateUrl := urlBytes.String()
|
||||
parsedUrl, err := url.Parse(templateUrl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -223,12 +224,16 @@ func (p *IndexerIRCParse) ParseMatch(baseURL string, vars map[string]string) (*I
|
|||
}
|
||||
|
||||
// join baseURL with query
|
||||
torrentURL, err := url.JoinPath(baseURL, parsedUrl.Path)
|
||||
baseUrlPath, err := url.JoinPath(baseURL, parsedUrl.Path)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not join torrent url")
|
||||
}
|
||||
|
||||
matched.TorrentURL = torrentURL
|
||||
// reconstruct url
|
||||
torrentUrl, _ := url.Parse(baseUrlPath)
|
||||
torrentUrl.RawQuery = parsedUrl.RawQuery
|
||||
|
||||
matched.TorrentURL = torrentUrl.String()
|
||||
}
|
||||
|
||||
if p.Match.TorrentName != "" {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue