summaryrefslogtreecommitdiffhomepage
path: root/resource/image.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2018-01-10 10:20:08 +0100
committerBjørn Erik Pedersen <[email protected]>2018-01-10 18:23:41 +0100
commitf0eecc6a4f541838e9930c98bc982546f65c7a4f (patch)
treec5d1b91d9a6201857bb20a6226a85aac09596db2 /resource/image.go
parent768ec5df9fa8f91610ee80a9e6194f94a7dbe117 (diff)
downloadhugo-f0eecc6a4f541838e9930c98bc982546f65c7a4f.tar.gz
hugo-f0eecc6a4f541838e9930c98bc982546f65c7a4f.zip
Fix non-ASCII path handling for Page resources
Fixes #4241
Diffstat (limited to 'resource/image.go')
-rw-r--r--resource/image.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/resource/image.go b/resource/image.go
index 678a78ad7..191aaf84c 100644
--- a/resource/image.go
+++ b/resource/image.go
@@ -185,7 +185,7 @@ type imageConfig struct {
}
func (i *Image) isJPEG() bool {
- name := strings.ToLower(i.rel)
+ name := strings.ToLower(i.relTargetPath)
return strings.HasSuffix(name, ".jpg") || strings.HasSuffix(name, ".jpeg")
}
@@ -206,7 +206,7 @@ func (i *Image) doWithImageConfig(action, spec string, f func(src image.Image, c
conf.Filter = imageFilters[conf.FilterStr]
}
- key := i.relPermalinkForRel(i.filenameFromConfig(conf), false)
+ key := i.relTargetPathForRel(i.filenameFromConfig(conf), false)
return i.spec.imageCache.getOrCreate(i.spec, key, func(resourceCacheFilename string) (*Image, error) {
ci := i.clone()
@@ -521,11 +521,11 @@ func (i *Image) clone() *Image {
}
func (i *Image) setBasePath(conf imageConfig) {
- i.rel = i.filenameFromConfig(conf)
+ i.relTargetPath = i.filenameFromConfig(conf)
}
func (i *Image) filenameFromConfig(conf imageConfig) string {
- p1, p2 := helpers.FileAndExt(i.rel)
+ p1, p2 := helpers.FileAndExt(i.relTargetPath)
idStr := fmt.Sprintf("_hu%s_%d", i.hash, i.osFileInfo.Size())
// Do not change for no good reason.