diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2019-09-05 18:03:00 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2019-09-05 19:59:49 +0200 |
commit | 3be2c25351b421a26ee1ff2a38cbab00280c0583 (patch) | |
tree | 16f5d469b7fc0875cd01dd45ef5cb9285e21c468 /hugolib/resource_chain_test.go | |
parent | 5e660947757023434dd7a1ec8b8239c0577fd501 (diff) |
Fix concat with fingerprint regression
In Hugo 0.58 we optimized the transformers that only adjusted metadata, e.g. the fingerprint.
This depended on the source readers implementing `io.ReadSeeker`.
The reader produced by `concat` did that, but the implementation was buggy.
This commit fixes that.
Fixes #6309
Diffstat (limited to 'hugolib/resource_chain_test.go')
-rw-r--r-- | hugolib/resource_chain_test.go | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/hugolib/resource_chain_test.go b/hugolib/resource_chain_test.go index fd1ee7e5e..138e7a4a2 100644 --- a/hugolib/resource_chain_test.go +++ b/hugolib/resource_chain_test.go @@ -284,7 +284,7 @@ Edited content. } } -func TestResourceChain(t *testing.T) { +func TestResourceChains(t *testing.T) { t.Parallel() c := qt.New(t) @@ -389,6 +389,23 @@ T3: Content: {{ $combinedJs.Content }}|{{ $combinedJs.RelPermalink }} ; (function F {})()`) }}, + + {"concat and fingerprint", func() bool { return true }, func(b *sitesBuilder) { + b.WithTemplates("home.html", ` +{{ $a := "A" | resources.FromString "a.txt"}} +{{ $b := "B" | resources.FromString "b.txt"}} +{{ $c := "C" | resources.FromString "c.txt"}} +{{ $combined := slice $a $b $c | resources.Concat "bundle/concat.txt" }} +{{ $fingerprinted := $combined | fingerprint }} +Fingerprinted: {{ $fingerprinted.RelPermalink }} +`) + }, func(b *sitesBuilder) { + + b.AssertFileContent("public/index.html", "Fingerprinted: /bundle/concat.b5d4045c3f466fa91fe2cc6abe79232a1a57cdf104f7a26e716e0a1e2789df78.txt") + b.AssertFileContent("public/bundle/concat.b5d4045c3f466fa91fe2cc6abe79232a1a57cdf104f7a26e716e0a1e2789df78.txt", "ABC") + + }}, + {"fromstring", func() bool { return true }, func(b *sitesBuilder) { b.WithTemplates("home.html", ` {{ $r := "Hugo Rocks!" | resources.FromString "rocks/hugo.txt" }} |