URI: 
       tpl: Use hash for cache key - hugo - [fork] hugo port for 9front
  HTML git clone git@git.drkhsh.at/hugo.git
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
   DIR README
   DIR LICENSE
       ---
   DIR commit 6cd33f6953671edb13d42dcb15746bd10df3428b
   DIR parent dbe63970e09313dec287816ab070b5c2f5a13b1b
  HTML Author: Jake Howard <RealOrangeOne@users.noreply.github.com>
       Date:   Fri, 21 Jul 2017 12:10:11 +0100
       
       tpl: Use hash for cache key
       
       Use a hash for the cache key, to fix 'file name too long' errors when retreiving from long urls
       
       Fixes #3690
       
       
       Diffstat:
         M tpl/data/cache.go                   |       6 ++++--
       
       1 file changed, 4 insertions(+), 2 deletions(-)
       ---
   DIR diff --git a/tpl/data/cache.go b/tpl/data/cache.go
       @@ -14,8 +14,9 @@
        package data
        
        import (
       +        "crypto/md5"
       +        "encoding/hex"
                "errors"
       -        "net/url"
                "sync"
        
                "github.com/gohugoio/hugo/config"
       @@ -27,7 +28,8 @@ var cacheMu sync.RWMutex
        
        // getCacheFileID returns the cache ID for a string.
        func getCacheFileID(cfg config.Provider, id string) string {
       -        return cfg.GetString("cacheDir") + url.QueryEscape(id)
       +        hash := md5.Sum([]byte(id))
       +        return cfg.GetString("cacheDir") + hex.EncodeToString(hash[:])
        }
        
        // getCache returns the content for an ID from the file cache or an error.