Correct content-type header and response for empty map tiles

This commit is contained in:
Lukas Rieger (Blue) 2024-02-24 10:44:25 +01:00
parent d1aba560da
commit 122ba83ebb
No known key found for this signature in database
GPG Key ID: AA33883B1BBA03E6
3 changed files with 6 additions and 7 deletions

View File

@ -109,7 +109,7 @@ public class MapStorageRequestHandler implements HttpRequestHandler {
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);

View File

@ -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);

View File

@ -221,7 +221,7 @@ public class Chunk_1_18 extends MCAChunk {
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;
}