Accept a byte-order mark in reskate-levels.json

The launcher and the server already skip one, so a map saved with a BOM was
listed everywhere but left out in game.
This commit is contained in:
xThrasherrr committed 2026-10-06 10:29:43 -06:00
1 parent 2cdc5ee8df
commit 650ff2db72
2 files changed
+3 -3

No files matched your search

+2 -2
View File
@@ -86,9 +86,9 @@ void exact_fields(const Json& object, std::initializer_list<std::string_view> ex
CustomLevelManifest parse(std::string_view text) {
if (text.size() > custom_level_manifest_max_bytes)
throw std::runtime_error("custom-level manifest exceeds 64 KiB");
if (text.starts_with("\xef\xbb\xbf"))
throw std::runtime_error("custom-level manifest must not contain a UTF-8 BOM");
// Json::parse skips a byte-order mark, which several Windows editors still
// write. The launcher and the server accept one, so the game must too.
const auto root = Json::parse(text, JsonLimits{
custom_level_manifest_max_bytes, 8, 8192});
exact_fields(root, {"schema", "levels"}, "custom-level manifest");
+1 -1
View File
@@ -23,7 +23,7 @@ struct CustomLevelManifest {
std::string issue;
};
// Parse the Studio-authored Patch/dingosdk-levels.json contract. Invalid input
// Parse a mod's or the Patch folder's reskate-levels.json. Invalid input
// fails closed: no partial set of destinations is returned.
CustomLevelManifest parse_custom_level_manifest(std::string_view text) noexcept;
CustomLevelManifest read_custom_level_manifest(const std::filesystem::path& path) noexcept;