aboutsummaryrefslogtreecommitdiffhomepage
path: root/cache
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2019-11-25 12:49:04 +0100
committerBjørn Erik Pedersen <[email protected]>2019-11-25 18:59:06 +0100
commitd6f7a9e28dfd5abff08b6aaf6fb3493c46bd1e39 (patch)
treef5715b86cff28eb5c7ab7320c30a492806441cae /cache
parent031f948f87ac97ca49d0a487a392a8a0c6afb699 (diff)
downloadhugo-d6f7a9e28dfd5abff08b6aaf6fb3493c46bd1e39.tar.gz
hugo-d6f7a9e28dfd5abff08b6aaf6fb3493c46bd1e39.zip
resources/images: Make the image cache more robust
Also allow timeout to be set as a duration string, e.g. `30s`. Fixes #6501
Diffstat (limited to 'cache')
-rw-r--r--cache/filecache/filecache.go2
-rw-r--r--cache/filecache/filecache_test.go4
2 files changed, 3 insertions, 3 deletions
diff --git a/cache/filecache/filecache.go b/cache/filecache/filecache.go
index 3628300fb..37870dd5f 100644
--- a/cache/filecache/filecache.go
+++ b/cache/filecache/filecache.go
@@ -129,7 +129,7 @@ func (c *Cache) WriteCloser(id string) (ItemInfo, io.WriteCloser, error) {
// If not found a new file is created and passed to create, which should close
// it when done.
func (c *Cache) ReadOrCreate(id string,
- read func(info ItemInfo, r io.Reader) error,
+ read func(info ItemInfo, r io.ReadSeeker) error,
create func(info ItemInfo, w io.WriteCloser) error) (info ItemInfo, err error) {
id = cleanID(id)
diff --git a/cache/filecache/filecache_test.go b/cache/filecache/filecache_test.go
index a4bf45fe0..5a5dac983 100644
--- a/cache/filecache/filecache_test.go
+++ b/cache/filecache/filecache_test.go
@@ -250,9 +250,9 @@ func TestFileCacheReadOrCreateErrorInRead(t *testing.T) {
var result string
- rf := func(failLevel int) func(info ItemInfo, r io.Reader) error {
+ rf := func(failLevel int) func(info ItemInfo, r io.ReadSeeker) error {
- return func(info ItemInfo, r io.Reader) error {
+ return func(info ItemInfo, r io.ReadSeeker) error {
if failLevel > 0 {
if failLevel > 1 {
return ErrFatal