mirror of
https://github.com/protomaps/PMTiles.git
synced 2026-02-04 10:51:07 +00:00
js: cleaner 404 error, change max directory depth to <= 3
This commit is contained in:
@@ -281,6 +281,11 @@ export class FetchSource implements Source {
|
|||||||
signal: signal,
|
signal: signal,
|
||||||
headers: { Range: "bytes=" + offset + "-" + (offset + length - 1) },
|
headers: { Range: "bytes=" + offset + "-" + (offset + length - 1) },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (resp.status >= 300) {
|
||||||
|
throw Error("404");
|
||||||
|
controller.abort();
|
||||||
|
}
|
||||||
const contentLength = resp.headers.get("Content-Length");
|
const contentLength = resp.headers.get("Content-Length");
|
||||||
if (!contentLength || +contentLength !== length) {
|
if (!contentLength || +contentLength !== length) {
|
||||||
console.error(
|
console.error(
|
||||||
@@ -789,7 +794,7 @@ export class PMTiles {
|
|||||||
|
|
||||||
let d_o = header.rootDirectoryOffset;
|
let d_o = header.rootDirectoryOffset;
|
||||||
let d_l = header.rootDirectoryLength;
|
let d_l = header.rootDirectoryLength;
|
||||||
for (let depth = 0; depth < 5; depth++) {
|
for (let depth = 0; depth <= 3; depth++) {
|
||||||
const directory = await this.cache.getDirectory(
|
const directory = await this.cache.getDirectory(
|
||||||
this.source,
|
this.source,
|
||||||
d_o,
|
d_o,
|
||||||
|
|||||||
Reference in New Issue
Block a user