webp-sh / webp_server_go

Go version of WebP Server. A tool that will serve your JPG/PNG/BMP/SVGs as WebP/AVIF format with compression, on-the-fly.
https://docs.webp.sh
GNU General Public License v3.0
1.79k stars 173 forks source link

Couldn't load xx.ico file #313

Closed IamTaoChen closed 7 months ago

IamTaoChen commented 7 months ago

Describe the bug

Could not read .ico file.

webp  | WebP Server Go is Running on http://0.0.0.0:3333
webp  | panic: runtime error: invalid memory address or nil pointer dereference
webp  |     panic: runtime error: invalid memory address or nil pointer dereference
webp  | [signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x796f2a]
webp  | 
webp  | goroutine 25 [running]:
webp  | github.com/davidbyttow/govips/v2/vips.(*ImageRef).Close(0x0)
webp  |     /go/pkg/mod/github.com/davidbyttow/govips/v2@v2.13.0/vips/image.go:575 +0x2a
webp  | panic({0x829040?, 0xba4380?})
webp  |     /usr/local/go/src/runtime/panic.go:770 +0x132
webp  | github.com/davidbyttow/govips/v2/vips.(*ImageRef).Format(...)
webp  |     /go/pkg/mod/github.com/davidbyttow/govips/v2@v2.13.0/vips/image.go:589
webp  | github.com/davidbyttow/govips/v2/vips.(*ImageRef).Metadata(0x0)
webp  |     /go/pkg/mod/github.com/davidbyttow/govips/v2@v2.13.0/vips/image.go:491 +0x17
webp  | webp_server_go/encoder.preProcessImage(0x0, {0x899619?, 0xc0000a4e50?}, {0x0?, 0x0?})
webp  |     /build/encoder/process.go:62 +0x4b
webp  | webp_server_go/encoder.convertImage({0xc000136e90, 0x10}, {0xc000142840, 0x23}, {0x899619, 0x4}, {0x0?, 0xc000092fd0?})
webp  |     /build/encoder/encoder.go:119 +0x2ca
webp  | webp_server_go/encoder.ConvertFilter.func2()
webp  |     /build/encoder/encoder.go:71 +0x51
webp  | created by webp_server_go/encoder.ConvertFilter in goroutine 24
webp  |     /build/encoder/encoder.go:70 +0x386
webp exited with code 0

To Reproduce Steps to reproduce the behavior

Expected behavior A clear and concise description of what you expected to happen.

Screenshots and logs If applicable, add screenshots and logs to help explain your problem.

Environment (please complete the following information):

Additional context Add any other context about the problem here.

n0vad3v commented 7 months ago

Thanks for feedback, but we don't currently support ICO files(because libvips will panic on ico files), as per our docs: https://docs.webp.sh/, we support the following files:

Currently supported image format: JPEG, PNG, BMP, GIF, SVG, HEIC, NEF, WEBP

From our default configuration ICO files should be ignored, could you share us a bit more about your configuration and usage?

IamTaoChen commented 7 months ago

thanks to know this.

{
    "HOST": "0.0.0.0",
    "PORT": "3333",
    "QUALITY": "80",
    "IMG_PATH": "./pics",
    "EXHAUST_PATH": "./exhaust",
    "ALLOWED_TYPES": ["jpg","png","jpeg","bmp","gif","svg","heic","ico","webp","avif"],
    "IMG_MAP": {},
    "ENABLE_AVIF": false,
    "ENABLE_EXTRA_PARAMS": true
  }
BennyThink commented 7 months ago

remove ico from your config and it should work