hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit d82cef5c53903dc52a353b3bd67d7ee11c55e4a4
parent 74f0777c5f61bcd639bb6d8995ebd5869a2d5cba
Author: roointan <37560641+roointan@users.noreply.github.com>
Date:   Sat,  8 Jan 2022 14:05:30 +0330

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

Fixes #8429
Diffstat:
Mhugolib/site.go | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/hugolib/site.go b/hugolib/site.go
@@ -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)
 	}