Repository navigation
Find custom maps in any case and play long entries from the server page - #539
Merged
Merged
Conversation
Two faults met running a dedicated server on Linux with Custom Edition
maps copied from Windows:
- A custom map whose file has capitals (cmt_Snow_Grove.map) could not be
played. The maps' list names each map in lower case, and the rotation's
check then looked for custom_maps/cmt_snow_grove.map exactly, which a
case-sensitive file system does not have ("there is no Custom Edition
map cmt_snow_grove"). map_file now falls back to the folder's entry of
that name in any case (posix_find_entry_case_insensitive), as the game's
own platform_translate_path already does when it loads the map. This
covers custom_maps, paths.custom_maps and Custom Edition's own folder.
- PLAY NOW on the page refused a rotation entry with many rules, such as
custom_maps\tsce_multiplayerv1:team_slayer+ff=off+team_vehicles=custom+
...+vehicle_respawn_time=60 (about 170 characters), with "map is needed
(no spaces)". The page sends such an entry whole as the map, and
POST /api/rotation/play read it into 128 bytes, though an entry may be
255 characters. The check is now rotation_play_line, which takes a
rotation entry's length and says so when a map is longer. The protocol
simulator and docs/dedicated_server.md say the same.
Nothing the machines send each other changes, so the network version
stays.
Checked: new harness cases resolve-case (test_server_rotation.py) and
rotation-play (test_server_http.py), each with a negative control
(custom-maps-case-sensitive, play-entries-short). On Windows the two
files' 161 tests passed before; now 164 pass and one is skipped:
custom-maps-case-sensitive, as NTFS finds a file in any case (it runs on
Linux). server_http.c and server_rotation.c compile
clean in the Windows build. The other tests that read these files
(test_server_toml.py, test_deploy_gametypes.py, test_server_sim.py) fail
the same way here before and after the change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two faults met while running a dedicated server on Linux (Hetzner, Docker image) with Custom Edition maps copied over from Windows.
Custom maps with capitals in their file name could not be played
cmt_Snow_Grove.mapshows in the page's map list ascmt_snow_grove, but adding or playing it failed with:The maps' list lowercases each name, and the rotation's check (
map_fileinserver_rotation.c) then openedcustom_maps/cmt_snow_grove.mapexactly, which a case-sensitive file system does not have. The game itself loads the map fine, sinceplatform_translate_pathalready resolves case.Fix: when the exact spelling isn't there,
map_filetakes the folder's entry of that name in any case (posix_find_entry_case_insensitive). This coverscustom_maps,paths.custom_mapsand Custom Edition's own maps folder.PLAY NOW refused rotation entries with many rules
An entry such as
custom_maps\tsce_multiplayerv1:team_slayer+ff=off+team_vehicles=custom+warthogs=4+…+vehicle_respawn_time=60(about 170 characters) plays fine from the rotation, but PLAY NOW answered:The page sends an entry with rules whole as
map, andPOST /api/rotation/playread it into 128 bytes, while an entry may be 255 characters.Fix: the check moves into
rotation_play_line, which takes a rotation entry's length (SERVER_ENTRY_TEXT_SIZE), and its message now names the limit. The protocol simulator (tools/server_sim.py) anddocs/dedicated_server.mdfollow.Nothing the machines send each other changes, so the network version stays.
Testing
resolve-case(test_server_rotation.py): aMixed_Case.mapin each of the three folders is listed and resolved by its lowercase name. A negative control (custom-maps-case-sensitive) removes the fallback. It is skipped on case-insensitive file systems (Windows), so the Linux CI job is where it runs.rotation-play(test_server_http.py): a 170-character entry, exactly 255 characters (taken) and 256 (refused, with the limit named), and the old refusals. Negative controlplay-entries-shortputs the 128-byte buffer back.server_http.candserver_rotation.ccompile cleanly in the Windows build. The other tests that read these files (test_server_toml.py,test_deploy_gametypes.py,test_server_sim.py) fail identically before and after, on Windows-only issues.sv_map <entry>in the console got around the second.🤖 Generated with Claude Code