mirror of https://github.com/Xhofe/alist
fix(fs/get): rawURL if use proxy (close #1664)
parent
a90ef201c7
commit
54ae6dce0b
|
@ -250,24 +250,24 @@ func FsGet(c *gin.Context) {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
provider = storage.Config().Name
|
provider = storage.Config().Name
|
||||||
}
|
}
|
||||||
// file have raw url
|
|
||||||
if !obj.IsDir() {
|
if !obj.IsDir() {
|
||||||
if u, ok := obj.(model.URL); ok {
|
if err != nil {
|
||||||
rawURL = u.URL()
|
common.ErrorResp(c, err, 500)
|
||||||
} else {
|
return
|
||||||
if err != nil {
|
}
|
||||||
common.ErrorResp(c, err, 500)
|
if storage.Config().MustProxy() || storage.GetStorage().WebProxy {
|
||||||
return
|
if storage.GetStorage().DownProxyUrl != "" {
|
||||||
|
rawURL = fmt.Sprintf("%s%s?sign=%s", strings.Split(storage.GetStorage().DownProxyUrl, "\n")[0], req.Path, sign.Sign(obj.GetName()))
|
||||||
|
} else {
|
||||||
|
rawURL = fmt.Sprintf("%s/p%s?sign=%s",
|
||||||
|
common.GetApiUrl(c.Request),
|
||||||
|
utils.EncodePath(req.Path, true),
|
||||||
|
sign.Sign(obj.GetName()))
|
||||||
}
|
}
|
||||||
if storage.Config().MustProxy() || storage.GetStorage().WebProxy {
|
} else {
|
||||||
if storage.GetStorage().DownProxyUrl != "" {
|
// file have raw url
|
||||||
rawURL = fmt.Sprintf("%s%s?sign=%s", strings.Split(storage.GetStorage().DownProxyUrl, "\n")[0], req.Path, sign.Sign(obj.GetName()))
|
if u, ok := obj.(model.URL); ok {
|
||||||
} else {
|
rawURL = u.URL()
|
||||||
rawURL = fmt.Sprintf("%s/p%s?sign=%s",
|
|
||||||
common.GetApiUrl(c.Request),
|
|
||||||
utils.EncodePath(req.Path, true),
|
|
||||||
sign.Sign(obj.GetName()))
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// if storage is not proxy, use raw url by fs.Link
|
// if storage is not proxy, use raw url by fs.Link
|
||||||
link, _, err := fs.Link(c, req.Path, model.LinkArgs{IP: c.ClientIP(), Header: c.Request.Header})
|
link, _, err := fs.Link(c, req.Path, model.LinkArgs{IP: c.ClientIP(), Header: c.Request.Header})
|
||||||
|
|
Loading…
Reference in New Issue