mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
Sanitize world directory names on create. Keep original name separate (#9432)
Blacklisted characters are replaced by '_' in the path. The display name is stored in world.mt, and duplicate file names are resolved by adding an incrementing suffix (_1, _2, _3, etc).
This commit is contained in:
parent
f948e2c585
commit
3ce03d1c2a
6 changed files with 136 additions and 17 deletions
|
@ -356,8 +356,13 @@ void Server::init()
|
|||
infostream << "- game: " << m_gamespec.path << std::endl;
|
||||
|
||||
// Create world if it doesn't exist
|
||||
if (!loadGameConfAndInitWorld(m_path_world, m_gamespec))
|
||||
throw ServerError("Failed to initialize world");
|
||||
try {
|
||||
loadGameConfAndInitWorld(m_path_world,
|
||||
fs::GetFilenameFromPath(m_path_world.c_str()),
|
||||
m_gamespec, false);
|
||||
} catch (const BaseException &e) {
|
||||
throw ServerError(std::string("Failed to initialize world: ") + e.what());
|
||||
}
|
||||
|
||||
// Create emerge manager
|
||||
m_emerge = new EmergeManager(this);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue