mirror of https://github.com/Xhofe/alist
fix: only file have raw_url
parent
90283ef29c
commit
e28c1e436d
|
@ -161,25 +161,27 @@ func FsGet(c *gin.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var rawURL string
|
var rawURL string
|
||||||
// obj have raw url
|
// file have raw url
|
||||||
if u, ok := obj.(model.URL); ok {
|
if !obj.IsDir() {
|
||||||
rawURL = u.URL()
|
if u, ok := obj.(model.URL); ok {
|
||||||
} else {
|
rawURL = u.URL()
|
||||||
account, _ := fs.GetAccount(req.Path)
|
|
||||||
if account.Config().MustProxy() || account.GetAccount().WebProxy {
|
|
||||||
if account.GetAccount().DownProxyUrl != "" {
|
|
||||||
rawURL = fmt.Sprintf("%s%s?sign=%s", strings.Split(account.GetAccount().DownProxyUrl, "\n")[0], req.Path, sign.Sign(obj.GetName()))
|
|
||||||
} else {
|
|
||||||
rawURL = fmt.Sprintf("%s/p%s?sign=%s", common.GetBaseUrl(c.Request), req.Path, sign.Sign(obj.GetName()))
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// if account is not proxy, use raw url by fs.Link
|
account, _ := fs.GetAccount(req.Path)
|
||||||
link, _, err := fs.Link(c, req.Path, model.LinkArgs{})
|
if account.Config().MustProxy() || account.GetAccount().WebProxy {
|
||||||
if err != nil {
|
if account.GetAccount().DownProxyUrl != "" {
|
||||||
common.ErrorResp(c, err, 500)
|
rawURL = fmt.Sprintf("%s%s?sign=%s", strings.Split(account.GetAccount().DownProxyUrl, "\n")[0], req.Path, sign.Sign(obj.GetName()))
|
||||||
return
|
} else {
|
||||||
|
rawURL = fmt.Sprintf("%s/p%s?sign=%s", common.GetBaseUrl(c.Request), req.Path, sign.Sign(obj.GetName()))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// if account is not proxy, use raw url by fs.Link
|
||||||
|
link, _, err := fs.Link(c, req.Path, model.LinkArgs{})
|
||||||
|
if err != nil {
|
||||||
|
common.ErrorResp(c, err, 500)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
rawURL = link.URL
|
||||||
}
|
}
|
||||||
rawURL = link.URL
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
common.SuccessResp(c, FsGetResp{
|
common.SuccessResp(c, FsGetResp{
|
||||||
|
|
Loading…
Reference in New Issue