Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(terabox): panic due to slice out of range #7499

Merged
merged 1 commit into from
Nov 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions drivers/terabox/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,15 @@ func (d *Terabox) request(rurl string, method string, callback base.ReqCallback,
return d.request(rurl, method, callback, resp, true)
}
} else if errno == -6 {
log.Debugln(res.Header())
d.url_domain_prefix = res.Header()["Url-Domain-Prefix"][0]
d.base_url = "https://" + d.url_domain_prefix + ".terabox.com"
log.Debugln("Redirect base_url to", d.base_url)
return d.request(rurl, method, callback, resp, noRetry...)
header := res.Header()
log.Debugln(header)
urlDomainPrefix := header.Get("Url-Domain-Prefix")
if len(urlDomainPrefix) > 0 {
d.url_domain_prefix = urlDomainPrefix
d.base_url = "https://" + d.url_domain_prefix + ".terabox.com"
log.Debugln("Redirect base_url to", d.base_url)
return d.request(rurl, method, callback, resp, noRetry...)
}
}
return res.Body(), nil
}
Expand Down
Loading