hugolib: Fix livereload problem with files including NFC characters in MacOs

Fixes #8429
This commit is contained in:
roointan 2022-01-08 14:05:30 +03:30 committed by GitHub
parent 74f0777c5f
commit d82cef5c53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,12 +24,14 @@ import (
"path"
"path/filepath"
"regexp"
"runtime"
"sort"
"strconv"
"strings"
"time"
"github.com/gohugoio/hugo/common/types"
"golang.org/x/text/unicode/norm"
"github.com/gohugoio/hugo/common/paths"
@ -950,6 +952,10 @@ func (s *Site) filterFileEvents(events []fsnotify.Event) []fsnotify.Event {
continue
}
if runtime.GOOS == "darwin" { // When a file system is HFS+, its filepath is in NFD form.
ev.Name = norm.NFC.String(ev.Name)
}
filtered = append(filtered, ev)
}