mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
resource/integrity: Make Data.Integrity be of type template.HTMLAttr
This commit is contained in:
@@ -21,6 +21,7 @@ import (
|
|||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"fmt"
|
"fmt"
|
||||||
"hash"
|
"hash"
|
||||||
|
"html/template"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/gohugoio/hugo/resource"
|
"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)
|
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) {
|
func digest(h hash.Hash) ([]byte, error) {
|
||||||
|
Reference in New Issue
Block a user