Skip to content

File path might violate windows length limits #1

Description

@garlic-hub

let game_id = format!("{epoch}-{player_slugs}-{safe_map}");
let filename = format!("{game_id}.json");

Windows file paths max out at 260 characters, including the drive path C:\ and null terminator at the end. A 4 on 4 or larger could easily blow past this limit as is. I think a simple length check and stripping out characters (before the .json) would probably be the minimum fix, though that's not ideal. Other options are trying to form a slug again without the player races or dynamically checking if the user has enabled extended path support. We could also save some characters by using the race shorthand HU/OR/UD/NE instead of the full name in the slugs and using a colon instead of parenthesis e.g.

1746300000-Foo(Human)-Bar(Undead)-LostTemple.json
becomes
1746300000-Foo:HU-Bar:UD-LostTemple.json

Admittedly not pretty, but might be worth it if end users aren't expected to work with these files manually.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions