consbio / mbtileserver

Basic Go server for mbtiles
ISC License
658 stars 104 forks source link

webp format tile parsing failed #110

Closed sys-liqian closed 3 years ago

sys-liqian commented 3 years ago

I use mbtilesserver v0.6.1 My tile is webp format. Program execution error : Could not detect tile format image

The basic element of a RIFF file is a chunk. It consists of: image

Chunk size is variable So i think can't use []byte("\x52\x49\x46\x46\xc0\x00\x00\x00\x57\x45\x42\x50\x56\x50") to verify whether it is webp

I changed the program to the following figure: image The program passed

brendan-ward commented 3 years ago

Thanks @buddhistSystem for the detailed write-up. I based this too much off an example tileset without studying the specification closely enough.

I went with a simplified approach that just checks for the RIFF part of the header; none of the other RIFF formats look like things that would be stored in a mbtiles file.

Please feel free to reopen this issue if the latest changes do not resolve this bug.