mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
fix(feeds): handle unicode escaped url characters (#1942)
* fix(rss): handle unicode escaped url characters * refactor: simplify URL encoding function name Co-authored-by: nuxen <47067662+nuxencs@users.noreply.github.com> * feat(feeds): sanitize download url --------- Co-authored-by: nuxen <47067662+nuxencs@users.noreply.github.com> Co-authored-by: ze0s <ze0s@riseup.net>
This commit is contained in:
parent
b2be5a703f
commit
f308286484
3 changed files with 118 additions and 3 deletions
|
@ -16,6 +16,7 @@ import (
|
|||
"github.com/autobrr/autobrr/internal/proxy"
|
||||
"github.com/autobrr/autobrr/internal/release"
|
||||
"github.com/autobrr/autobrr/pkg/errors"
|
||||
"github.com/autobrr/autobrr/pkg/sanitize"
|
||||
|
||||
"github.com/dustin/go-humanize"
|
||||
"github.com/mmcdole/gofeed"
|
||||
|
@ -148,7 +149,7 @@ func (j *RSSJob) processItem(item *gofeed.Item) *domain.Release {
|
|||
}
|
||||
|
||||
if rls.DownloadURL == "" && item.Link != "" {
|
||||
rls.DownloadURL = item.Link
|
||||
rls.DownloadURL = sanitize.URLEncoding(item.Link)
|
||||
}
|
||||
|
||||
if rls.DownloadURL != "" {
|
||||
|
@ -158,8 +159,8 @@ func (j *RSSJob) processItem(item *gofeed.Item) *domain.Release {
|
|||
if parentURL, _ := url.Parse(j.URL); parentURL != nil {
|
||||
parentURL.Path, parentURL.RawPath = "", ""
|
||||
|
||||
// unescape the query params for max compatibility
|
||||
escapedUrl, _ := url.QueryUnescape(parentURL.JoinPath(rls.DownloadURL).String())
|
||||
downloadURL := sanitize.URLEncoding(rls.DownloadURL)
|
||||
escapedUrl, _ := url.QueryUnescape(parentURL.JoinPath(downloadURL).String())
|
||||
rls.DownloadURL = escapedUrl
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue