mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-09-27 14:52:57 +02:00
Correct content-type header and response for empty map tiles
This commit is contained in:
parent
d1aba560da
commit
122ba83ebb
@ -109,7 +109,7 @@ public HttpResponse handle(HttpRequest request) {
|
|||||||
if (lastModified > 0)
|
if (lastModified > 0)
|
||||||
response.addHeader("Last-Modified", timestampToString(lastModified));
|
response.addHeader("Last-Modified", timestampToString(lastModified));
|
||||||
|
|
||||||
if (lod == 0) response.addHeader("Content-Type", "application/json");
|
if (lod == 0) response.addHeader("Content-Type", "application/octet-stream");
|
||||||
else response.addHeader("Content-Type", "image/png");
|
else response.addHeader("Content-Type", "image/png");
|
||||||
|
|
||||||
writeToResponse(compressedIn, response, request);
|
writeToResponse(compressedIn, response, request);
|
||||||
|
@ -165,7 +165,7 @@ if (startsWith($path, "/maps/")) {
|
|||||||
if ($compression !== "none")
|
if ($compression !== "none")
|
||||||
header("Content-Encoding: $compression");
|
header("Content-Encoding: $compression");
|
||||||
if ($lod === 0) {
|
if ($lod === 0) {
|
||||||
header("Content-Type: application/json");
|
header("Content-Type: application/octet-stream");
|
||||||
} else {
|
} else {
|
||||||
header("Content-Type: image/png");
|
header("Content-Type: image/png");
|
||||||
}
|
}
|
||||||
@ -175,9 +175,8 @@ if (startsWith($path, "/maps/")) {
|
|||||||
|
|
||||||
} catch (PDOException $e) { error(500, "Failed to fetch data"); }
|
} catch (PDOException $e) { error(500, "Failed to fetch data"); }
|
||||||
|
|
||||||
// empty json response if nothing found
|
// no content if nothing found
|
||||||
header("Content-Type: application/json");
|
http_response_code(204);
|
||||||
echo "{}";
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ public BlockState getBlockState(int x, int y, int z) {
|
|||||||
|
|
||||||
int id = blocks.get((y & 0xF) << 8 | (z & 0xF) << 4 | x & 0xF);
|
int id = blocks.get((y & 0xF) << 8 | (z & 0xF) << 4 | x & 0xF);
|
||||||
if (id >= blockPalette.length) {
|
if (id >= blockPalette.length) {
|
||||||
Logger.global.noFloodWarning("palette-warning", "Got block-palette id " + id + " but palette has size of " + blockPalette.length + ". (Chunk");
|
Logger.global.noFloodWarning("palette-warning", "Got block-palette id " + id + " but palette has size of " + blockPalette.length + ".");
|
||||||
return BlockState.MISSING;
|
return BlockState.MISSING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user