mirror of
https://github.com/go-shiori/shiori.git
synced 2025-01-16 12:57:58 +08:00
Fix URL not unescaped on archival process
This commit is contained in:
parent
54e02e5c76
commit
0324784c7c
1 changed files with 4 additions and 5 deletions
|
@ -47,14 +47,13 @@ func ToResourceURL(uri string, base *nurl.URL) ResourceURL {
|
|||
// So, for archival URL, we need to unescape the query and path first.
|
||||
tmp, err := nurl.Parse(downloadURL)
|
||||
if err == nil {
|
||||
tmp.RawPath = tmp.Path
|
||||
|
||||
newQuery, _ := nurl.QueryUnescape(tmp.RawQuery)
|
||||
if newQuery != "" {
|
||||
tmp.RawQuery = newQuery
|
||||
unescapedQuery, _ := nurl.QueryUnescape(tmp.RawQuery)
|
||||
if unescapedQuery != "" {
|
||||
tmp.RawQuery = unescapedQuery
|
||||
}
|
||||
|
||||
archivalURL = tmp.String()
|
||||
archivalURL = strings.Replace(archivalURL, tmp.EscapedPath(), tmp.Path, 1)
|
||||
}
|
||||
|
||||
archivalURL = strings.ReplaceAll(archivalURL, "://", "/")
|
||||
|
|
Loading…
Reference in a new issue