diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2025-01-16 19:15:30 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2025-01-18 12:23:18 +0100 |
commit | 1f5a15aba0fc7cc4f4cf4ce1afc8d6db81c63e06 (patch) | |
tree | 5a8cf37158d2c700ecf9f059c464697a0e2cbc56 /resources/transform_test.go | |
parent | 8897113666c9e7e62fed945602910ebcd0ec6421 (diff) | |
download | hugo-1f5a15aba0fc7cc4f4cf4ce1afc8d6db81c63e06.tar.gz hugo-1f5a15aba0fc7cc4f4cf4ce1afc8d6db81c63e06.zip |
resources: Fix 2 image file cache key issues
* Always include the content hash in the cache key for unprocessed images.
* Always include the image config hash in the cache key.
This is also a major cleanup/simplification of the implementation in this area.
Note that this, unfortunately, forces new hashes/filenames for generated images.
Fixes #13273
Fixes #13272
Diffstat (limited to 'resources/transform_test.go')
-rw-r--r-- | resources/transform_test.go | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/resources/transform_test.go b/resources/transform_test.go index b036a44d7..79d4841b1 100644 --- a/resources/transform_test.go +++ b/resources/transform_test.go @@ -386,22 +386,15 @@ func TestTransform(t *testing.T) { resizedPublished1, err := img.Resize("40x40") c.Assert(err, qt.IsNil) c.Assert(resizedPublished1.Height(), qt.Equals, 40) - c.Assert(resizedPublished1.RelPermalink(), qt.Equals, "/gopher.changed_hu16988682630555427117.png") - assertShouldExist(c, spec, "public/gopher.changed_hu16988682630555427117.png", true) + c.Assert(resizedPublished1.RelPermalink(), qt.Equals, "/gopher.changed_hu_85920388a7ff96fa.png") + assertShouldExist(c, spec, "public/gopher.changed_hu_85920388a7ff96fa.png", true) // Permalink called. resizedPublished2, err := img.Resize("30x30") c.Assert(err, qt.IsNil) c.Assert(resizedPublished2.Height(), qt.Equals, 30) - c.Assert(resizedPublished2.Permalink(), qt.Equals, "https://example.com/gopher.changed_hu14141325020798305104.png") - assertShouldExist(c, spec, "public/gopher.changed_hu14141325020798305104.png", true) - - // Not published because none of RelPermalink or Permalink was called. - resizedNotPublished, err := img.Resize("50x50") - c.Assert(err, qt.IsNil) - c.Assert(resizedNotPublished.Height(), qt.Equals, 50) - // c.Assert(resized.RelPermalink(), qt.Equals, "/gopher.changed_hu2e827f5a78333ebc04166dd643235dea_1462_50x50_resize_linear_2.png") - assertShouldExist(c, spec, "public/gopher.changed_hu2e827f5a78333ebc04166dd643235dea_1462_50x50_resize_linear_3.png", false) + c.Assert(resizedPublished2.Permalink(), qt.Equals, "https://example.com/gopher.changed_hu_c8d8163c08643a7f.png") + assertShouldExist(c, spec, "public/gopher.changed_hu_c8d8163c08643a7f.png", true) assertNoDuplicateWrites(c, spec) }) |