shithub: hugo

Download patch

ref: fe6a6f2737769070fd64a5192ff685c9c89020bd
parent: 2650fa772b40846d9965f8c5f169286411f3beb2
author: Bjørn Erik Pedersen <[email protected]>
date: Sun Sep 23 19:40:35 EDT 2018

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

--- a/resource/integrity/integrity.go
+++ b/resource/integrity/integrity.go
@@ -21,6 +21,7 @@
 	"encoding/hex"
 	"fmt"
 	"hash"
+	"html/template"
 	"io"
 
 	"github.com/gohugoio/hugo/resource"
@@ -93,10 +94,9 @@
 	)
 }
 
-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) {