feat(quark): shard request file (close #4175)

This commit is contained in:
Andy Hsu
2023-04-17 15:31:39 +08:00
parent 7f35aab071
commit 8711f2a1c5
5 changed files with 68 additions and 14 deletions

View File

@ -72,6 +72,8 @@ func Proxy(w http.ResponseWriter, r *http.Request, link *model.Link, file model.
w.Header().Set("Content-Disposition", fmt.Sprintf(`attachment; filename="%s"; filename*=UTF-8''%s`, filename, url.PathEscape(filename)))
http.ServeContent(w, r, file.GetName(), fileStat.ModTime(), f)
return nil
} else if link.Handle != nil {
return link.Handle(w, r)
} else {
req, err := http.NewRequest(r.Method, link.URL, nil)
if err != nil {

View File

@ -21,6 +21,7 @@ import (
"github.com/alist-org/alist/v3/internal/sign"
"github.com/alist-org/alist/v3/pkg/utils"
"github.com/alist-org/alist/v3/server/common"
log "github.com/sirupsen/logrus"
)
type Handler struct {
@ -237,6 +238,7 @@ func (h *Handler) handleGetHeadPost(w http.ResponseWriter, r *http.Request) (sta
}
err = common.Proxy(w, r, link, fi)
if err != nil {
log.Errorf("webdav proxy error: %+v", err)
return http.StatusInternalServerError, err
}
} else if storage.GetStorage().WebdavProxy() && downProxyUrl != "" {