Skip to content

Commit

Permalink
hugolib: Fix livereload problem with files including NFC characters i…
Browse files Browse the repository at this point in the history
…n MacOs

Fixes #8429
  • Loading branch information
roointan committed Jan 8, 2022
1 parent 74f0777 commit d82cef5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions hugolib/site.go
Expand Up @@ -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"

Expand Down Expand Up @@ -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)
}

Expand Down

0 comments on commit d82cef5

Please sign in to comment.