mirror of
https://github.com/rclone/rclone.git
synced 2025-06-24 22:11:45 +02:00
local: fix --skip-links on Windows when skipping Junction points
Due to a change in Go which was enabled by the `go 1.22` in `go.mod` rclone has stopped skipping junction points ("My Documents" in particular) if `--skip-links` is set on Windows. This is because the output from os.Lstat has changed and junction points are no longer marked with os.ModeSymlink but with os.ModeIrregular instead. This fix now skips os.ModeIrregular objects if --skip-links is set on Windows only. Fixes #8561 See: https://github.com/golang/go/issues/73827
This commit is contained in:
parent
fe3253eefd
commit
17b25d7ce2
@ -1201,7 +1201,15 @@ func (o *Object) Storable() bool {
|
|||||||
o.fs.objectMetaMu.RLock()
|
o.fs.objectMetaMu.RLock()
|
||||||
mode := o.mode
|
mode := o.mode
|
||||||
o.fs.objectMetaMu.RUnlock()
|
o.fs.objectMetaMu.RUnlock()
|
||||||
if mode&os.ModeSymlink != 0 && !o.fs.opt.TranslateSymlinks {
|
|
||||||
|
// On Windows items with os.ModeIrregular are likely Junction
|
||||||
|
// points so we treat them as symlinks for the purpose of ignoring them.
|
||||||
|
// https://github.com/golang/go/issues/73827
|
||||||
|
symlinkFlag := os.ModeSymlink
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
symlinkFlag |= os.ModeIrregular
|
||||||
|
}
|
||||||
|
if mode&symlinkFlag != 0 && !o.fs.opt.TranslateSymlinks {
|
||||||
if !o.fs.opt.SkipSymlinks {
|
if !o.fs.opt.SkipSymlinks {
|
||||||
fs.Logf(o, "Can't follow symlink without -L/--copy-links")
|
fs.Logf(o, "Can't follow symlink without -L/--copy-links")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user