From 299bfb4d7b2edfbb0c02b3979fb370fd355a0e6b Mon Sep 17 00:00:00 2001 From: foxxorcat <95907542+foxxorcat@users.noreply.github.com> Date: Mon, 25 Dec 2023 11:28:57 +0800 Subject: [PATCH] feat(115): support 302 redirect (#5733) --- drivers/115/driver.go | 7 ++++++- drivers/115/meta.go | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/115/driver.go b/drivers/115/driver.go index 15f6b4087b4..96bf9d45837 100644 --- a/drivers/115/driver.go +++ b/drivers/115/driver.go @@ -63,8 +63,13 @@ func (d *Pan115) Link(ctx context.Context, file model.Obj, args model.LinkArgs) if err := d.WaitLimit(ctx); err != nil { return nil, err } + var userAgent = args.Header.Get("User-Agent") + if userAgent == "" { + userAgent = driver115.UA115Browser + } + downloadInfo, err := d.client. - DownloadWithUA(file.(*FileObj).PickCode, driver115.UA115Browser) + DownloadWithUA(file.(*FileObj).PickCode, userAgent) if err != nil { return nil, err } diff --git a/drivers/115/meta.go b/drivers/115/meta.go index 16ec22cdab8..d3e937bf8e7 100644 --- a/drivers/115/meta.go +++ b/drivers/115/meta.go @@ -16,7 +16,7 @@ type Addition struct { var config = driver.Config{ Name: "115 Cloud", DefaultRoot: "0", - OnlyProxy: true, + //OnlyProxy: true, //OnlyLocal: true, NoOverwriteUpload: true, }