mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-08 22:31:04 +00:00
This commit is contained in:
parent
fc81e2b3d7
commit
99c9d65ddf
@ -215,18 +215,14 @@ func (w *walker) walkAndHashFiles(ctx context.Context, toHashChan chan<- protoco
|
||||
skip = fs.SkipDir
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
w.handleError(ctx, "scan", path, err, finishedChan)
|
||||
if !utf8.ValidString(path) {
|
||||
w.handleError(ctx, "scan", path, errUTF8Invalid, finishedChan)
|
||||
return skip
|
||||
}
|
||||
|
||||
if path == "." {
|
||||
return nil
|
||||
}
|
||||
|
||||
if fs.IsTemporary(path) {
|
||||
l.Debugln("temporary:", path)
|
||||
if info.IsRegular() && info.ModTime().Add(w.TempLifetime).Before(now) {
|
||||
l.Debugln("temporary:", path, "err:", err)
|
||||
if err == nil && info.IsRegular() && info.ModTime().Add(w.TempLifetime).Before(now) {
|
||||
w.Filesystem.Remove(path)
|
||||
l.Debugln("removing temporary:", path, info.ModTime())
|
||||
}
|
||||
@ -238,15 +234,10 @@ func (w *walker) walkAndHashFiles(ctx context.Context, toHashChan chan<- protoco
|
||||
return skip
|
||||
}
|
||||
|
||||
if !utf8.ValidString(path) {
|
||||
w.handleError(ctx, "scan", path, errUTF8Invalid, finishedChan)
|
||||
return skip
|
||||
}
|
||||
|
||||
if w.Matcher.Match(path).IsIgnored() {
|
||||
l.Debugln("ignored (patterns):", path)
|
||||
// Only descend if matcher says so and the current file is not a symlink.
|
||||
if w.Matcher.SkipIgnoredDirs() || info.IsSymlink() {
|
||||
if err != nil || w.Matcher.SkipIgnoredDirs() || info.IsSymlink() {
|
||||
return skip
|
||||
}
|
||||
// If the parent wasn't ignored already, set this path as the "highest" ignored parent
|
||||
@ -256,6 +247,15 @@ func (w *walker) walkAndHashFiles(ctx context.Context, toHashChan chan<- protoco
|
||||
return nil
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
w.handleError(ctx, "scan", path, err, finishedChan)
|
||||
return skip
|
||||
}
|
||||
|
||||
if path == "." {
|
||||
return nil
|
||||
}
|
||||
|
||||
if ignoredParent == "" {
|
||||
// parent isn't ignored, nothing special
|
||||
return w.handleItem(ctx, path, toHashChan, finishedChan, skip)
|
||||
|
@ -252,6 +252,7 @@ func TestNormalization(t *testing.T) {
|
||||
|
||||
func TestIssue1507(t *testing.T) {
|
||||
w := &walker{}
|
||||
w.Matcher = ignore.New(w.Filesystem)
|
||||
h := make(chan protocol.FileInfo, 100)
|
||||
f := make(chan ScanResult, 100)
|
||||
fn := w.walkAndHashFiles(context.TODO(), h, f)
|
||||
|
Loading…
Reference in New Issue
Block a user