Hello and hope you’re doing well
I’m trying to fix this issue hugo server fails to refresh when filename includes NFC characters in MacOS · Issue #8429 · gohugoio/hugo · GitHub as my first contribution to Hugo.
I’ve spent some time on it today, and I was planning to spend more time in the upcoming days to figure things out. But if someone could explain things (even briefly) to me it’d be a huge boost.
I went back in time, and saw this code name = norm.NFC.String(name)
was added to fix this issue: Static sync to memory fails with Norwegian "å" · Issue #2203 · gohugoio/hugo · GitHub
I tested the issue, and it was happening on my device and it’s reproduced for me. Also if I comment the above code (which is now residing in fileinfo.go), the issue is fixed and livereload would work correctly.
I tried debugging code and to my wonder, the code is running both through the firstSite.processPartial
and firstSite.process
paths, but only livereload fails.
I have three questions that would help me better understand this.
-
Here: Static sync to memory fails with Norwegian "å" · Issue #2203 · gohugoio/hugo · GitHub ks888 mentioned that “Mac OS’s HFS+ file system, a file name is automatically normalized to NFD. Even if we save a file name in NFC, we need to use NFD to open the file.”
But I wonder why the code added to fix that is normalising names to NFC? Shouldn’t the fix actually be normalising to NFD on darwin architecture? -
I did not quite understand “fails to sync” in Static sync to memory fails with Norwegian "å" · Issue #2203 · gohugoio/hugo · GitHub what does it mean? I want to make sure whatever solution, will not break that one.
-
How does hugofs work?
Again ks888 mentioned this:
“I think this issue can be fixed by normalizing a file name to NFC when files are added to Hugo’s filesystem, so that we can use NFC to access files in any cases.”
but I don’t know how Hugo’s filesystem work. Any explanation or link to an explanation would help me.
I think I could figure things out eventually, but any help will help me a lot and is much appreciated!