Drop and warn about non-normalized file names on Linux/Windows (fixes #329)

This commit is contained in:
Jakob Borg
2014-06-11 17:51:31 +02:00
parent e63596681d
commit 7454670b0a
2 changed files with 19 additions and 4 deletions

View File

@@ -13,6 +13,7 @@ import (
"runtime"
"strings"
"time"
"code.google.com/p/go.text/unicode/norm"
"github.com/calmh/syncthing/lamport"
"github.com/calmh/syncthing/protocol"
@@ -159,6 +160,11 @@ func (w *Walker) walkAndHashFiles(res *[]File, ign map[string][]string) filepath
return nil
}
if (runtime.GOOS == "linux" || runtime.GOOS == "windows") && !norm.NFC.IsNormalString(rn) {
l.Warnf("File %q contains non-NFC UTF-8 sequences and cannot be synced. Consider renaming.", rn)
return nil
}
if info.Mode().IsDir() {
if w.CurrentFiler != nil {
cf := w.CurrentFiler.CurrentFile(rn)