From 1e76fc994a44fab94d835970a4181943227fda30 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sun, 13 Jun 2021 07:09:06 -0700 Subject: [PATCH] filer.copy: zero fileSize for directories --- weed/command/filer_copy.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/weed/command/filer_copy.go b/weed/command/filer_copy.go index a5d29c451..9d21c40ef 100644 --- a/weed/command/filer_copy.go +++ b/weed/command/filer_copy.go @@ -213,11 +213,15 @@ func genFileCopyTask(fileOrDir string, destPath string, fileCopyTaskChan chan Fi mode := fi.Mode() uid, gid := util.GetFileUidGid(fi) + fileSize := fi.Size() + if mode.IsDir() { + fileSize = 0 + } fileCopyTaskChan <- FileCopyTask{ sourceLocation: fileOrDir, destinationUrlPath: destPath, - fileSize: fi.Size(), + fileSize: fileSize, fileMode: fi.Mode(), uid: uid, gid: gid,