Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sanitize vessel filenames #29

Merged

Conversation

HebaruSan
Copy link
Contributor

Hi @Boris-Barboris! A user posted a log on the forum, and I noticed this while investigating:

https://forum.kerbalspaceprogram.com/index.php?/topic/206468-having-unexpected-mark-stack-overflow-and-other-unexpected-crashes-in-a-modded-install/

Problem

If a user on Windows puts a " character in a vessel's name, this is seen in the log:

[LOG 16:28:11.920] [AtmosphereAutopilot]: Serialization exception in path D:/Steam/steamapps/common/Kerbal Space Program/KSP_x64_Data/../GameData/AtmosphereAutopilot/designs/XR6 Launcher "amphibia".txt message Illegal characters in path.

This causes the serialization to fail. I don't know enough about AtmosphereAutopilot to assess what else might break downstream from this.

Cause

Windows doesn't allow certain characters in filenames, including ", and AtmosphereAutopilot is trying to put user input into a filename without sanitizing it.

Changes

Now this filename is passed through KSPUtil.SanitizeFilename before use (the same thing the stock game does with .craft files), so it will not contain illegal characters.

@Boris-Barboris Boris-Barboris merged commit 2b2dd5b into Boris-Barboris:master Jan 17, 2022
@Boris-Barboris
Copy link
Owner

thanks!

@HebaruSan HebaruSan deleted the fix/sanitize-vessel-filenames branch January 17, 2022 20:28
Lisias pushed a commit to net-lisias-kspu/AtmosphereAutopilot that referenced this pull request Jun 12, 2023
…oris#29 from HebaruSan/fix/sanitize-vessel-filenames

Sanitize vessel filenames
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants