Hugo 0.111 and 0.115
Passing the name Blüte.webp to Resource.Copy creates a file Bl%C3%BCte.webp (on macOS, but I guess it works the same on other platforms). The Permalink of this file is http://... Bl%C3%BCte.webp. Which the browser tries to load the file, it converts this to http://... Blüte.webp.
But obviously, there is no file Blüte.webp, since Resource.Copy URL-encoded the umlaut. Non-ASCII characters in filenames are ok now on the web, and there are quite some languages that rely on them. My file system supports them, my browser does (and it does the necessary URL conversion, too).
Is that the intended behavior? If so – why? If not, maybe it should be fixed.
And when you click “Link to image” you see this (notice the address bar):
So I’m not sure where the problem is. Try it:
git clone --single-branch -b hugo-forum-topic-45092 https://github.com/jmooring/hugo-testing hugo-forum-topic-45092
cd hugo-forum-topic-45092
hugo server
The original file contains an “ü” (or any other non-ASCII character, afaict)
I get the resource with this file and use its Key to obtain the full path
Which, as it turns out, is the problem here. Key does the conversion to URL-encoded, and I do not even need it – Name works just fine, since Resources.Copy apparently copies into the “current directory” (or whatever is the correct term here – not that the documentation says anything about it).
So, replacing Key with Name in my code made everything behave as it should. Thanks again.