Enforce correct filename normalization (fixes #96)

This commit is contained in:
Jakob Borg
2014-03-21 09:09:01 +01:00
parent a4e56caf78
commit 68d9454bc4
5 changed files with 34 additions and 5 deletions

View File

@@ -9,6 +9,8 @@ import (
"path/filepath"
"strings"
"time"
"code.google.com/p/go.text/unicode/norm"
)
type Walker struct {
@@ -136,6 +138,7 @@ func (w *Walker) loadIgnoreFiles(dir string, ign map[string][]string) filepath.W
func (w *Walker) walkAndHashFiles(res *[]File, ign map[string][]string) filepath.WalkFunc {
return func(p string, info os.FileInfo, err error) error {
if err != nil {
if debug {
dlog.Println("error:", p, info, err)
@@ -151,6 +154,9 @@ func (w *Walker) walkAndHashFiles(res *[]File, ign map[string][]string) filepath
return nil
}
// Internally, we always use unicode normalization form C
rn = norm.NFC.String(rn)
if w.TempNamer != nil && w.TempNamer.IsTemporary(rn) {
if debug {
dlog.Println("temporary:", rn)