diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-01-15 20:22:14 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-01-15 20:22:14 +0100 |
commit | ecaf14514e06321823bdd10235cf23e7d654ba77 (patch) | |
tree | 5df06870d994d326fb75ed03ac43f9e61e29ab3b /resource/image_test.go | |
parent | d4f8f88e67f958b8010f90cb9b9854114e52dac2 (diff) |
resource: Fix handling of very long image file names
Fixes #4261
Diffstat (limited to 'resource/image_test.go')
-rw-r--r-- | resource/image_test.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/resource/image_test.go b/resource/image_test.go index 073a16352..28f68a46c 100644 --- a/resource/image_test.go +++ b/resource/image_test.go @@ -115,6 +115,25 @@ func TestImageTransform(t *testing.T) { } +// https://github.com/gohugoio/hugo/issues/4261 +func TestImageTransformLongFilename(t *testing.T) { + assert := require.New(t) + + image := fetchImage(assert, "1234567890qwertyuiopasdfghjklzxcvbnm5to6eeeeee7via8eleph.jpg") + assert.NotNil(image) + + resized, err := image.Resize("200x") + assert.NoError(err) + assert.NotNil(resized) + assert.Equal(200, resized.Width()) + assert.Equal("/a/_hu59e56ffff1bc1d8d122b1403d34e039f_90587_fd0f8b23902abcf4092b68783834f7fe.jpg", resized.RelPermalink()) + resized, err = resized.Resize("100x") + assert.NoError(err) + assert.NotNil(resized) + assert.Equal(100, resized.Width()) + assert.Equal("/a/_hu59e56ffff1bc1d8d122b1403d34e039f_90587_5f399e62910070692b3034a925f1b2d7.jpg", resized.RelPermalink()) +} + func TestDecodeImaging(t *testing.T) { assert := require.New(t) m := map[string]interface{}{ |