resource/integrity: Make Data.Integrity be of type template.HTMLAttr

This commit is contained in:
Bjørn Erik Pedersen 2018-09-23 23:40:35 +02:00
parent 2650fa772b
commit fe6a6f2737
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F

View file

@ -21,6 +21,7 @@ import (
"encoding/hex"
"fmt"
"hash"
"html/template"
"io"
"github.com/gohugoio/hugo/resource"
@ -93,10 +94,9 @@ func (c *Client) Fingerprint(res resource.Resource, algo string) (resource.Resou
)
}
func integrity(algo string, sum []byte) string {
func integrity(algo string, sum []byte) template.HTMLAttr {
encoded := base64.StdEncoding.EncodeToString(sum)
return fmt.Sprintf("%s-%s", algo, encoded)
return template.HTMLAttr(fmt.Sprintf("%s-%s", algo, encoded))
}
func digest(h hash.Hash) ([]byte, error) {