v0.0.493 fix panic in RegisterImage for very short images
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 5m22s
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 5m22s
This commit is contained in:
@@ -65,7 +65,12 @@ func (b *WPDFBuilder) RegisterImage(bin []byte, opts ...*PDFImageRegisterOpt) *P
|
||||
}
|
||||
|
||||
if imageType == "" {
|
||||
ct := http.DetectContentType(bin[:512])
|
||||
ct := ""
|
||||
if len(bin) > 512 {
|
||||
ct = http.DetectContentType(bin[:512])
|
||||
} else {
|
||||
ct = http.DetectContentType(bin)
|
||||
}
|
||||
switch ct {
|
||||
case "image/jpg":
|
||||
imageType = "JPG"
|
||||
|
Reference in New Issue
Block a user