From c5f6a90f5454156af30c2f87ca9ff02484b20715 Mon Sep 17 00:00:00 2001 From: Andy Hsu Date: Fri, 14 Apr 2023 13:47:05 +0800 Subject: [PATCH] fix(quark): download file size limit (close #4140) --- drivers/quark/driver.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/quark/driver.go b/drivers/quark/driver.go index dc668b474d4..b992881149a 100644 --- a/drivers/quark/driver.go +++ b/drivers/quark/driver.go @@ -56,8 +56,10 @@ func (d *Quark) Link(ctx context.Context, file model.Obj, args model.LinkArgs) ( "fids": []string{file.GetID()}, } var resp DownResp + ua := "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) quark-cloud-drive/2.5.20 Chrome/100.0.4896.160 Electron/18.3.5.4-b478491100 Safari/537.36 Channel/pckk_other_ch" _, err := d.request("/file/download", http.MethodPost, func(req *resty.Request) { - req.SetBody(data) + req.SetHeader("User-Agent", ua). + SetBody(data) }, &resp) if err != nil { return nil, err @@ -65,8 +67,9 @@ func (d *Quark) Link(ctx context.Context, file model.Obj, args model.LinkArgs) ( return &model.Link{ URL: resp.Data[0].DownloadUrl, Header: http.Header{ - "Cookie": []string{d.Cookie}, - "Referer": []string{"https://pan.quark.cn"}, + "Cookie": []string{d.Cookie}, + "Referer": []string{"https://pan.quark.cn"}, + "User-Agent": []string{ua}, }, }, nil }