Ability to skip processing of some formats

This commit is contained in:
DarthSim
2020-08-13 19:52:35 +06:00
parent fa4dd9f346
commit 08dc814e98
4 changed files with 47 additions and 0 deletions

View File

@@ -186,6 +186,21 @@ func handleProcessing(reqID string, rw http.ResponseWriter, r *http.Request) {
checkTimeout(ctx)
if len(conf.SkipProcessingFormats) > 0 {
imgdata := getImageData(ctx)
po := getProcessingOptions(ctx)
if imgdata.Type == po.Format || po.Format == imageTypeUnknown {
for _, f := range conf.SkipProcessingFormats {
if f == imgdata.Type {
po.Format = imgdata.Type
respondWithImage(ctx, reqID, r, rw, imgdata.Data)
return
}
}
}
}
imageData, processcancel, err := processImage(ctx)
defer processcancel()
if err != nil {