From 62dae50d70be2b7327e6eddbe1b11f6b628441f4 Mon Sep 17 00:00:00 2001 From: NewbieOrange Date: Sun, 12 Feb 2023 16:03:11 +0800 Subject: [PATCH] feat(fs): create symbolic link instead of copy local files (close #2186 in #3354) --- internal/fs/util.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/fs/util.go b/internal/fs/util.go index b5d0cb4b64c..795a18883a0 100644 --- a/internal/fs/util.go +++ b/internal/fs/util.go @@ -41,9 +41,9 @@ func getFileStreamFromLink(file model.Obj, link *model.Link) (*model.FileStream, if link.Data != nil { rc = link.Data } else if link.FilePath != nil { - // copy a new temp, because will be deleted after upload + // create a new temp symbolic link, because it will be deleted after upload newFilePath := stdpath.Join(conf.Conf.TempDir, fmt.Sprintf("%s-%s", uuid.NewString(), file.GetName())) - err := utils.CopyFile(*link.FilePath, newFilePath) + err := os.Symlink(*link.FilePath, newFilePath) if err != nil { return nil, err }