"encoding/hex"
"fmt"
"hash"
- "html/template"
"io"
"github.com/gohugoio/hugo/resources/internal"
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) {
import (
"context"
- "html/template"
"testing"
"github.com/gohugoio/hugo/resources/resource"
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!")