mirror of
https://github.com/gohugoio/hugo.git
synced 2025-09-01 22:42:45 +02:00
Consolidate all hashing to the common/hashing package
And remove now unsued hashing funcs.
This commit is contained in:
@@ -26,7 +26,6 @@ import (
|
||||
"github.com/bep/logg"
|
||||
"github.com/gohugoio/httpcache"
|
||||
hhttpcache "github.com/gohugoio/hugo/cache/httpcache"
|
||||
"github.com/gohugoio/hugo/helpers"
|
||||
"github.com/gohugoio/hugo/hugofs/glob"
|
||||
"github.com/gohugoio/hugo/identity"
|
||||
|
||||
@@ -34,6 +33,7 @@ import (
|
||||
|
||||
"github.com/gohugoio/hugo/cache/dynacache"
|
||||
"github.com/gohugoio/hugo/cache/filecache"
|
||||
"github.com/gohugoio/hugo/common/hashing"
|
||||
"github.com/gohugoio/hugo/common/hcontext"
|
||||
"github.com/gohugoio/hugo/common/hugio"
|
||||
"github.com/gohugoio/hugo/common/tasks"
|
||||
@@ -226,7 +226,7 @@ func (c *Client) match(name, pattern string, matchFunc func(r resource.Resource)
|
||||
// TODO(bep) see #10912; we currently emit a warning for this config scenario.
|
||||
func (c *Client) FromString(targetPath, content string) (resource.Resource, error) {
|
||||
targetPath = path.Clean(targetPath)
|
||||
key := dynacache.CleanKey(targetPath) + helpers.MD5String(content)
|
||||
key := dynacache.CleanKey(targetPath) + hashing.MD5FromStringHexEncoded(content)
|
||||
r, err := c.rs.ResourceCache.GetOrCreate(key, func() (resource.Resource, error) {
|
||||
return c.rs.NewResource(
|
||||
resources.ResourceSourceDescriptor{
|
||||
|
@@ -29,6 +29,7 @@ import (
|
||||
gmaps "maps"
|
||||
|
||||
"github.com/gohugoio/httpcache"
|
||||
"github.com/gohugoio/hugo/common/hashing"
|
||||
"github.com/gohugoio/hugo/common/hugio"
|
||||
"github.com/gohugoio/hugo/common/loggers"
|
||||
"github.com/gohugoio/hugo/common/maps"
|
||||
@@ -310,10 +311,10 @@ func (c *Client) validateFromRemoteArgs(uri string, options fromRemoteOptions) e
|
||||
func remoteResourceKeys(uri string, optionsm map[string]any) (string, string) {
|
||||
var userKey string
|
||||
if key, k, found := maps.LookupEqualFold(optionsm, "key"); found {
|
||||
userKey = identity.HashString(key)
|
||||
userKey = hashing.HashString(key)
|
||||
delete(optionsm, k)
|
||||
}
|
||||
optionsKey := identity.HashString(uri, optionsm)
|
||||
optionsKey := hashing.HashString(uri, optionsm)
|
||||
if userKey == "" {
|
||||
userKey = optionsKey
|
||||
}
|
||||
|
Reference in New Issue
Block a user