lib/protocol: Don't warn when dropping deleted invalid item (fixes #6795) (#6796)

This commit is contained in:
Simon Frei 2020-06-25 20:24:31 +02:00 committed by GitHub
parent 0648fb0626
commit 80ada1bb6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -7,6 +7,7 @@ package protocol
// Windows uses backslashes as file separator
import (
"fmt"
"path/filepath"
"strings"
)
@ -39,7 +40,13 @@ func fixupFiles(files []FileInfo) []FileInfo {
var out []FileInfo
for i := range files {
if strings.Contains(files[i].Name, `\`) {
l.Warnf("Dropping index entry for %s, contains invalid path separator", files[i].Name)
msg := fmt.Sprintf("Dropping index entry for %s, contains invalid path separator", files[i].Name)
if files[i].Deleted {
// Dropping a deleted item doesn't have any consequences.
l.Debugln(msg)
} else {
l.Warnln(msg)
}
if out == nil {
// Most incoming updates won't contain anything invalid, so
// we delay the allocation and copy to output slice until we