summaryrefslogtreecommitdiffhomepage
path: root/source/filesystem.go
diff options
context:
space:
mode:
authorKishin Yagami <[email protected]>2016-08-09 03:25:00 +0900
committerBjørn Erik Pedersen <[email protected]>2016-08-08 20:25:00 +0200
commit39df7724ad958cfaee631ea1cdc3c29343b63763 (patch)
tree393a08066420daa579c314fa6e7cbe38b5d7dbc0 /source/filesystem.go
parentb33bfd40bed7af36faba18bed09efb6b95c58192 (diff)
downloadhugo-39df7724ad958cfaee631ea1cdc3c29343b63763.tar.gz
hugo-39df7724ad958cfaee631ea1cdc3c29343b63763.zip
source: Normalize file name to NFC
Fixes #2203
Diffstat (limited to 'source/filesystem.go')
-rw-r--r--source/filesystem.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/source/filesystem.go b/source/filesystem.go
index 9d723685e..7bdcd702f 100644
--- a/source/filesystem.go
+++ b/source/filesystem.go
@@ -18,9 +18,11 @@ import (
"os"
"path/filepath"
"regexp"
+ "runtime"
"strings"
"github.com/spf13/hugo/hugofs"
+ "golang.org/x/text/unicode/norm"
"github.com/spf13/viper"
@@ -66,6 +68,11 @@ func (f *Filesystem) Files() []*File {
func (f *Filesystem) add(name string, reader io.Reader) (err error) {
var file *File
+ if runtime.GOOS == "darwin" {
+ // When a file system is HFS+, its filepath is in NFD form.
+ name = norm.NFC.String(name)
+ }
+
file, err = NewFileFromAbs(f.Base, name, reader)
if err == nil {