mirror of
https://github.com/tickstep/aliyunpan.git
synced 2025-02-02 21:27: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 {
|
} else if t.Mode == DownloadOnly {
|
||||||
go t.scanPanFile(t.ctx)
|
go t.scanPanFile(t.ctx)
|
||||||
} else {
|
} else {
|
||||||
return fmt.Errorf("异常:暂不支持的该模式。")
|
return fmt.Errorf("异常:暂不支持该模式。")
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -479,6 +479,12 @@ func (t *SyncTask) scanLocalFile(ctx context.Context) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 跳过软链接文件
|
||||||
|
if IsSymlinkFile(file) {
|
||||||
|
logger.Verboseln("软链接文件,跳过:" + item.path + "/" + file.Name())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
logger.Verboseln("扫描到本地文件:" + item.path + "/" + file.Name())
|
logger.Verboseln("扫描到本地文件:" + item.path + "/" + file.Name())
|
||||||
// 文件夹需要增加到扫描队列
|
// 文件夹需要增加到扫描队列
|
||||||
if file.IsDir() {
|
if file.IsDir() {
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package syncdrive
|
package syncdrive
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"io/fs"
|
||||||
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
@ -22,3 +24,11 @@ func GetLocalFileFullPathFromPanPath(panFilePath, localRootPath, panRootPath str
|
|||||||
relativePath := strings.TrimPrefix(panFilePath, panRootPath)
|
relativePath := strings.TrimPrefix(panFilePath, panRootPath)
|
||||||
return path.Join(path.Clean(localRootPath), relativePath)
|
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