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

check file type as well

parent 13165b74
Pipeline #42065 passed with stages
in 2 minutes and 46 seconds
......@@ -276,8 +276,8 @@ func (iai *ActionImageIIIF) cacheThumbnail(imageBuf []byte, me *MediaEntry) (boo
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))
} 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)
}
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