From c59dbb4f9ee16be6e0f682478b04ce40a0c20057 Mon Sep 17 00:00:00 2001 From: Andy Hsu Date: Thu, 10 Aug 2023 16:42:09 +0800 Subject: [PATCH] fix(local): files get deleted when copied to other storage (close #4983) --- drivers/local/driver.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/local/driver.go b/drivers/local/driver.go index 38c923e3f14..7bd54638be2 100644 --- a/drivers/local/driver.go +++ b/drivers/local/driver.go @@ -5,6 +5,7 @@ import ( "context" "errors" "fmt" + "io" "io/fs" "net/http" "os" @@ -180,7 +181,15 @@ func (d *Local) Link(ctx context.Context, file model.Obj, args model.LinkArgs) ( if err != nil { return nil, err } - link.ReadSeekCloser = open + link.ReadSeekCloser = struct { + io.Reader + io.Seeker + io.Closer + }{ + Reader: open, + Seeker: open, + Closer: open, + } } return &link, nil }