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