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)
iai.ms.log.Debugf("Length of %v: %v", cachedUri, len(imageBuf))
if l := len(imageBuf); l < 1024 {
iai.ms.log.Warningf("Length of %v (%v) is too small to reasonable be a thumbnail", cachedUri, l)
return false, nil
} else {
iai.ms.log.Debugf("Length of %v: %v", cachedUri, len(imageBuf))
}
f, err := os.Create(cachedUri)
if err != nil {
iai.ms.log.Errorf("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