Fixes WebP detection, resolves #110, #98

This commit is contained in:
Brendan C. Ward 2021-05-13 19:40:55 -07:00
parent 3de7e6bd97
commit a14c94fad7
No known key found for this signature in database
GPG Key ID: 37A8A7A2D61DFE13
5 changed files with 11 additions and 2 deletions

View File

@ -47,6 +47,8 @@ Most of the updates are demonstrated in `main.go`.
### General changes
- Upgraded Docker containers to Go 1.16
### Command-line interface
- added support for automatically generating unique tileset IDs using `--generate-ids` option
@ -87,6 +89,10 @@ Most of the updates are demonstrated in `main.go`.
- removed `ServiceSet.AddDBOnPath()`; this is replaced by calling
`ServiceSet.AddTileset()` for each `Tileset` to register.
### Bug fixes
- Fixed WebP parsing, now uses simplified check for a `RIFF` header (WebP is only likely RIFF format to be stored in tiles). #98, #110
## 0.6.1
- upgraded Docker containers to Go 1.14 (solves out of memory issues during builds on small containers)

View File

@ -373,7 +373,10 @@ func detectTileFormat(data *[]byte) (TileFormat, error) {
ZLIB: []byte("\x78\x9c"),
PNG: []byte("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A"),
JPG: []byte("\xFF\xD8\xFF"),
WEBP: []byte("\x52\x49\x46\x46\xc0\x00\x00\x00\x57\x45\x42\x50\x56\x50"),
// NOTE: this is technically only the RIFF part of the header,
// but none of the other RIFF file formats are likely to be stored
// as tiles.
WEBP: []byte("\x52\x49\x46\x46"),
}
for format, pattern := range patterns {

View File

@ -10,8 +10,8 @@ func Test_ListDBs(t *testing.T) {
var expected = []string{
"testdata/geography-class-jpg.mbtiles",
"testdata/geography-class-png.mbtiles",
"testdata/geography-class-webp.mbtiles",
"testdata/world_cities.mbtiles",
"testdata/openstreetmap/open-streets-dc.mbtiles",
}
filenames, err := mbtiles.ListDBs("./testdata")

Binary file not shown.