From 53c8faaafc65f4fe737bb83081d3d22c607ec80b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor-bj=C3=B6rn=20Claesson?= Date: Thu, 4 Nov 2021 13:17:04 +0200 Subject: [PATCH] LibCore: Trim trailing whitespaces from ConfigFile values Previously, trailing whitespaces were not removed from values in config files. This could cause errors with poorly formatted files. This commit fixes this by trimming whitespaces from values in ConfigFile::reparse(). --- Userland/Libraries/LibCore/ConfigFile.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibCore/ConfigFile.cpp b/Userland/Libraries/LibCore/ConfigFile.cpp index f6820354f9..e272a2b26a 100644 --- a/Userland/Libraries/LibCore/ConfigFile.cpp +++ b/Userland/Libraries/LibCore/ConfigFile.cpp @@ -106,7 +106,8 @@ void ConfigFile::reparse() // We're not in a group yet, create one with the name ""... current_group = &m_groups.ensure(""); } - current_group->set(key_builder.to_string(), value_builder.to_string()); + auto value_string = value_builder.to_string(); + current_group->set(key_builder.to_string(), value_string.trim_whitespace(TrimMode::Right)); } } }