From 5e7c222e913b73cde0c38c67db8bb09d44bfbab0 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Wed, 1 May 2024 17:41:21 +0800 Subject: [PATCH] :art: Copy file ignore symlink --- file.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/file.go b/file.go index 7785bb4..ab7b49c 100644 --- a/file.go +++ b/file.go @@ -267,6 +267,11 @@ func (*GuluFile) copyFile(source, dest string, chtimes bool) (err error) { return } + if 0 == sourceinfo.Mode()&os.ModeSymlink { + // 忽略符号链接 + return + } + if err = os.Chmod(dest, sourceinfo.Mode()); nil != err { return }