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:
Jakob Borg
2017-03-18 00:25:47 +00:00
committed by Audrius Butkevicius
parent a54365424e
commit 5c27796471
3 changed files with 52 additions and 3 deletions

View File

@@ -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
}