mirror of
https://github.com/tickstep/aliyunpan.git
synced 2025-01-23 22:42:15 +08:00
skip symlink file for upload mode
This commit is contained in:
parent
3fcbbe9b40
commit
25202861c5
@ -209,7 +209,7 @@ func (t *SyncTask) Start() error {
|
||||
} else if t.Mode == DownloadOnly {
|
||||
go t.scanPanFile(t.ctx)
|
||||
} else {
|
||||
return fmt.Errorf("异常:暂不支持的该模式。")
|
||||
return fmt.Errorf("异常:暂不支持该模式。")
|
||||
}
|
||||
|
||||
return nil
|
||||
@ -479,6 +479,12 @@ func (t *SyncTask) scanLocalFile(ctx context.Context) {
|
||||
continue
|
||||
}
|
||||
|
||||
// 跳过软链接文件
|
||||
if IsSymlinkFile(file) {
|
||||
logger.Verboseln("软链接文件,跳过:" + item.path + "/" + file.Name())
|
||||
continue
|
||||
}
|
||||
|
||||
logger.Verboseln("扫描到本地文件:" + item.path + "/" + file.Name())
|
||||
// 文件夹需要增加到扫描队列
|
||||
if file.IsDir() {
|
||||
|
@ -1,6 +1,8 @@
|
||||
package syncdrive
|
||||
|
||||
import (
|
||||
"io/fs"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
)
|
||||
@ -22,3 +24,11 @@ func GetLocalFileFullPathFromPanPath(panFilePath, localRootPath, panRootPath str
|
||||
relativePath := strings.TrimPrefix(panFilePath, panRootPath)
|
||||
return path.Join(path.Clean(localRootPath), relativePath)
|
||||
}
|
||||
|
||||
// IsSymlinkFile 是否是软链接文件
|
||||
func IsSymlinkFile(file fs.FileInfo) bool {
|
||||
if file.Mode()&os.ModeSymlink != 0 {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user