Skip to content

Commit e2b79ec

Browse files
committed
fix issue that Imagek internal error will return 200 empty body
1 parent 7b9a8ec commit e2b79ec

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

thumberd/thumberd.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,13 @@ func thumbServer(w http.ResponseWriter, r *http.Request, sem chan int) {
495495
// sem is the semaphore to restrict concurrent ImageMagick workers to the number of CPU core
496496
sem <- 1
497497
err = thumbnail.MakeThumbnailMagick(srcReader.Body, w, params)
498+
if err != nil {
499+
message := "Magick failed: " + err.Error()
500+
glog.Error(message, http.StatusInternalServerError)
501+
http.Error(w, message, http.StatusInternalServerError)
502+
atomic.AddInt64(&http_stats.thumb_error, 1)
503+
return
504+
}
498505
<-sem
499506

500507
atomic.AddInt64(&http_stats.ok, 1)

0 commit comments

Comments
 (0)