Verified Commit 13165b74 authored by Sebastian Schüpbach's avatar Sebastian Schüpbach
Browse files

ignore very small thumbnail files

parent 36960de0
Pipeline #42061 passed with stages
in 2 minutes and 42 seconds
......@@ -273,7 +273,12 @@ func (iai *ActionImageIIIF) tryFetchCachedThumbnail(w http.ResponseWriter, me *M
func (iai *ActionImageIIIF) cacheThumbnail(imageBuf []byte, me *MediaEntry) (bool, error) {
cachedUri := iai.generatePathToCachedImage(me)"Length of %v: %v", cachedUri, len(imageBuf))
if l := len(imageBuf); l < 1024 {"Length of %v (%v) is too small to reasonable be a thumbnail", cachedUri, l)
return false, nil
} else {"Length of %v: %v", cachedUri, len(imageBuf))
f, err := os.Create(cachedUri)
if err != nil {"An error occurred when creating cache file: %v", err)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment