diff options
author | Bjørn Erik Pedersen <[email protected]> | 2024-07-30 15:47:34 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2024-07-31 16:44:06 +0200 |
commit | e67886c038dc79755c14ec77bbeff6605953f9ef (patch) | |
tree | 6b36585a55796b5a29d41764175e4d6d82a0d206 /resources/resource_factories | |
parent | d5eda13cb2e57998210b66e080dc96e95b38e5f0 (diff) | |
download | hugo-e67886c038dc79755c14ec77bbeff6605953f9ef.tar.gz hugo-e67886c038dc79755c14ec77bbeff6605953f9ef.zip |
Consolidate all hashing to the common/hashing package
And remove now unsued hashing funcs.
Diffstat (limited to 'resources/resource_factories')
-rw-r--r-- | resources/resource_factories/create/create.go | 4 | ||||
-rw-r--r-- | resources/resource_factories/create/remote.go | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/resources/resource_factories/create/create.go b/resources/resource_factories/create/create.go index 35a1fb59d..2d868bd15 100644 --- a/resources/resource_factories/create/create.go +++ b/resources/resource_factories/create/create.go @@ -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{ diff --git a/resources/resource_factories/create/remote.go b/resources/resource_factories/create/remote.go index 5f4879dfe..606110d57 100644 --- a/resources/resource_factories/create/remote.go +++ b/resources/resource_factories/create/remote.go @@ -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 } |