浏览代码

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().
Tor-björn Claesson 3 年之前
父节点
当前提交
53c8faaafc
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      Userland/Libraries/LibCore/ConfigFile.cpp

+ 2 - 1
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));
         }
         }
     }