Skip to content

Commit

Permalink
return 404 if tile not found in leaf [#2]
Browse files Browse the repository at this point in the history
  • Loading branch information
bdon committed May 3, 2021
1 parent 9b4cf17 commit dee5491
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,20 @@ func main() {
} else {
leaf := pmtiles.GetParentTile(coord, root_value.directory.LeafZ)

offsetlen := root_value.directory.Leaves[leaf]
offsetlen, ok := root_value.directory.Leaves[leaf]
if !ok {
w.WriteHeader(404)
return
}
leaf_req := Request{kind: Leaf, key: Key{name: name, rng: offsetlen}, value: make(chan Datum, 1)}
reqs <- leaf_req
leaf_value := <-leaf_req.value

offsetlen = leaf_value.directory.Entries[coord]
offsetlen, ok = leaf_value.directory.Entries[coord]
if !ok {
w.WriteHeader(404)
return
}
tile_req := Request{kind: Tile, key: Key{name: name, rng: offsetlen}, value: make(chan Datum, 1)}
reqs <- tile_req
tile_value := <-tile_req.value
Expand Down

0 comments on commit dee5491

Please sign in to comment.