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

raise size limit to qualify as a thumbnail image

parent f26bc63f
Pipeline #48020 passed with stages
in 2 minutes and 26 seconds
......@@ -273,11 +273,11 @@ func (iai *ActionImageIIIF) tryFetchCachedThumbnail(w http.ResponseWriter, me *M
func (iai *ActionImageIIIF) cacheThumbnail(imageBuf []byte, me *MediaEntry) (bool, error) {
cachedUri := iai.generatePathToCachedImage(me)
if l := len(imageBuf); l < 1024 {
iai.ms.log.Warningf("Length of %v (%v) is too small to reasonable be a thumbnail", cachedUri, l)
if l := len(imageBuf); l < (8 * 1024) {
iai.ms.log.Infof("Size of %v (%v) is too small to qualify to be cached", cachedUri, l)
return false, nil
} else if mimetype := http.DetectContentType(imageBuf); mimetype != "image/jpeg" && mimetype != "image/png" {
iai.ms.log.Warningf("File %v doesn't seem to be an image file: %v", cachedUri, mimetype)
iai.ms.log.Errorf("File %v doesn't seem to be an image file: %v", cachedUri, mimetype)
}
f, err := os.Create(cachedUri)
if err != nil {
......
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