mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-23 20:25:37 +00:00
bugfix: trim archived map names (#4632)
## Description: fixed a bug where "Deglaciated Antarctica" had a trailing space in an earlier version of the game and caused visual issues: <img width="1045" height="323" alt="image" src="https://github.com/user-attachments/assets/11628e19-523e-43f9-b3dc-15a5ee1bcd8a" /> and prevented stats from loading: <img width="1070" height="529" alt="image" src="https://github.com/user-attachments/assets/590a7c2b-7dc5-4d8d-816f-469731d42fd4" /> now works: <img width="969" height="387" alt="image" src="https://github.com/user-attachments/assets/35d4ac89-5f97-4534-adbc-d0ce824ea4d8" /> <img width="1013" height="787" alt="image" src="https://github.com/user-attachments/assets/44d6c20a-caf6-417a-b7fe-08f0765e1b16" /> ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory ## Please put your Discord username so you can be contacted if a bug or regression is found: w.o.n
This commit is contained in:
@@ -246,7 +246,7 @@ export const PublicPlayerGameSchema = z.object({
|
||||
gameId: z.string(),
|
||||
start: z.iso.datetime(),
|
||||
durationSeconds: z.number().int().nonnegative(),
|
||||
map: z.string(),
|
||||
map: z.string().trim(),
|
||||
mode: z.string(),
|
||||
type: z.string(),
|
||||
playerTeams: z.string().nullable(),
|
||||
|
||||
@@ -198,7 +198,7 @@ export const ClanGameSchema = z.object({
|
||||
gameId: z.string(),
|
||||
start: z.iso.datetime(),
|
||||
durationSeconds: z.number().int().nonnegative(),
|
||||
map: z.string().optional(),
|
||||
map: z.string().trim().optional(),
|
||||
mode: z.string().optional(),
|
||||
// playerTeams is `null` (not absent) for FFA / non-team games — use
|
||||
// `.nullish()` so the wire `null` doesn't fail the parse.
|
||||
|
||||
@@ -947,6 +947,10 @@ const ArchivedPlayerRecordSchema = PlayerRecordSchema.extend({
|
||||
export const ArchivedAnalyticsRecordSchema = AnalyticsRecordSchema.extend({
|
||||
info: GameEndInfoSchema.extend({
|
||||
config: GameConfigSchema.extend({
|
||||
gameMap: z.preprocess(
|
||||
(value) => (typeof value === "string" ? value.trim() : value),
|
||||
GameConfigSchema.shape.gameMap,
|
||||
),
|
||||
// predates configurable nation count
|
||||
nations: GameConfigSchema.shape.nations
|
||||
.catch("default")
|
||||
|
||||
Reference in New Issue
Block a user