diff options
author | Joe Mooring <[email protected]> | 2023-09-29 09:22:58 -0700 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2023-10-02 20:14:50 +0200 |
commit | 4c95389c25af48190be82de110ae830df7077eeb (patch) | |
tree | 614942c930e4c7e9929e58e6695f316f8ec33d0f /resources/resource_transformers | |
parent | 3af8bded26db1fa4c0ab292139371802a14026dc (diff) | |
download | hugo-4c95389c25af48190be82de110ae830df7077eeb.tar.gz hugo-4c95389c25af48190be82de110ae830df7077eeb.zip |
resources/integrity: Return string instead of template.HTMLAttr
Closes #11513
Diffstat (limited to 'resources/resource_transformers')
-rw-r--r-- | resources/resource_transformers/integrity/integrity.go | 5 | ||||
-rw-r--r-- | resources/resource_transformers/integrity/integrity_test.go | 3 |
2 files changed, 3 insertions, 5 deletions
diff --git a/resources/resource_transformers/integrity/integrity.go b/resources/resource_transformers/integrity/integrity.go index 3a7db4c80..63f4f4c76 100644 --- a/resources/resource_transformers/integrity/integrity.go +++ b/resources/resource_transformers/integrity/integrity.go @@ -21,7 +21,6 @@ import ( "encoding/hex" "fmt" "hash" - "html/template" "io" "github.com/gohugoio/hugo/resources/internal" @@ -109,9 +108,9 @@ func (c *Client) Fingerprint(res resources.ResourceTransformer, algo string) (re return res.Transform(&fingerprintTransformation{algo: algo}) } -func integrity(algo string, sum []byte) template.HTMLAttr { +func integrity(algo string, sum []byte) string { encoded := base64.StdEncoding.EncodeToString(sum) - return template.HTMLAttr(algo + "-" + encoded) + return algo + "-" + encoded } func digest(h hash.Hash) ([]byte, error) { diff --git a/resources/resource_transformers/integrity/integrity_test.go b/resources/resource_transformers/integrity/integrity_test.go index ef3f13a55..27e193618 100644 --- a/resources/resource_transformers/integrity/integrity_test.go +++ b/resources/resource_transformers/integrity/integrity_test.go @@ -15,7 +15,6 @@ package integrity import ( "context" - "html/template" "testing" "github.com/gohugoio/hugo/resources/resource" @@ -63,7 +62,7 @@ func TestTransform(t *testing.T) { c.Assert(err, qt.IsNil) c.Assert(transformed.RelPermalink(), qt.Equals, "/hugo.a5ad1c6961214a55de53c1ce6e60d27b6b761f54851fa65e33066460dfa6a0db.txt") - c.Assert(transformed.Data(), qt.DeepEquals, map[string]any{"Integrity": template.HTMLAttr("sha256-pa0caWEhSlXeU8HObmDSe2t2H1SFH6ZeMwZkYN+moNs=")}) + c.Assert(transformed.Data(), qt.DeepEquals, map[string]any{"Integrity": "sha256-pa0caWEhSlXeU8HObmDSe2t2H1SFH6ZeMwZkYN+moNs="}) content, err := transformed.(resource.ContentProvider).Content(context.Background()) c.Assert(err, qt.IsNil) c.Assert(content, qt.Equals, "Hugo Rocks!") |