mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-11-22 02:26:00 +01: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)
|
||||
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");
|
||||
|
||||
writeToResponse(compressedIn, response, request);
|
||||
|
@ -165,7 +165,7 @@ if (startsWith($path, "/maps/")) {
|
||||
if ($compression !== "none")
|
||||
header("Content-Encoding: $compression");
|
||||
if ($lod === 0) {
|
||||
header("Content-Type: application/json");
|
||||
header("Content-Type: application/octet-stream");
|
||||
} else {
|
||||
header("Content-Type: image/png");
|
||||
}
|
||||
@ -175,9 +175,8 @@ if (startsWith($path, "/maps/")) {
|
||||
|
||||
} catch (PDOException $e) { error(500, "Failed to fetch data"); }
|
||||
|
||||
// empty json response if nothing found
|
||||
header("Content-Type: application/json");
|
||||
echo "{}";
|
||||
// no content if nothing found
|
||||
http_response_code(204);
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -206,4 +205,4 @@ if (startsWith($path, "/maps/")) {
|
||||
}
|
||||
|
||||
// no match => 404
|
||||
error(404);
|
||||
error(404);
|
||||
|
@ -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);
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user