lib/model, lib/scanner: Properly ignore symlinks on Windows (fixes #4035)
Adds a unit test to ensure we don't scan symlinks on Windows. For the rwfolder, trusts that the logic in the invalid check is correct and that the check is actually called from the need loop. GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4042
This commit is contained in:
committed by
Audrius Butkevicius
parent
a54365424e
commit
5c27796471
@@ -53,8 +53,9 @@ type copyBlocksState struct {
|
||||
const retainBits = os.ModeSetgid | os.ModeSetuid | os.ModeSticky
|
||||
|
||||
var (
|
||||
activity = newDeviceActivity()
|
||||
errNoDevice = errors.New("peers who had this file went away, or the file has changed while syncing. will retry later")
|
||||
activity = newDeviceActivity()
|
||||
errNoDevice = errors.New("peers who had this file went away, or the file has changed while syncing. will retry later")
|
||||
errSymlinksUnsupported = errors.New("symlinks not supported")
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -1759,6 +1760,9 @@ func fileValid(file db.FileIntf) error {
|
||||
// We don't care about file validity if we're not supposed to have it
|
||||
return nil
|
||||
|
||||
case runtime.GOOS == "windows" && file.IsSymlink():
|
||||
return errSymlinksUnsupported
|
||||
|
||||
case runtime.GOOS == "windows" && windowsInvalidFilename(file.FileName()):
|
||||
return errInvalidFilename
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user