lib/model: Check for invalid filenames after ignore patterns

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4607
LGTM: calmh, AudriusButkevicius
This commit is contained in:
Simon Frei
2017-12-25 17:54:34 +00:00
committed by Audrius Butkevicius
parent c58b383b6d
commit 841205dbfe
2 changed files with 86 additions and 8 deletions

View File

@@ -382,14 +382,6 @@ func (f *sendReceiveFolder) pullerIteration(ignores *ignore.Matcher, ignoresChan
return true
}
// If filename isn't valid, we can terminate early with an appropriate error.
// in case it is deleted, we don't care about the filename, so don't complain.
if !intf.IsDeleted() && runtime.GOOS == "windows" && fs.WindowsInvalidFilename(intf.FileName()) {
f.newError("need", intf.FileName(), fs.ErrInvalidFilename)
changed++
return true
}
file := intf.(protocol.FileInfo)
switch {
@@ -398,6 +390,11 @@ func (f *sendReceiveFolder) pullerIteration(ignores *ignore.Matcher, ignoresChan
l.Debugln(f, "Handling ignored file", file)
dbUpdateChan <- dbUpdateJob{file, dbUpdateInvalidate}
case runtime.GOOS == "windows" && fs.WindowsInvalidFilename(file.Name):
f.newError("need", file.Name, fs.ErrInvalidFilename)
changed++
return true
case file.IsDeleted():
processDirectly = append(processDirectly, file)
changed++