36 lines
1.2 KiB
Diff
36 lines
1.2 KiB
Diff
From 9e670738044166cdd0bf566325bf610bfb802821 Mon Sep 17 00:00:00 2001
|
|
From: Jaroslav Rohel <jrohel@redhat.com>
|
|
Date: Mon, 24 Jun 2019 16:34:47 +0200
|
|
Subject: [PATCH] [config] ignore trailing blank lines of multiline value (RhBug:1722493)
|
|
|
|
Parser supports multiline values. Example:
|
|
key = value first line
|
|
value second line
|
|
|
|
If a line starts with whitespaces and it is not a section name,
|
|
it is treated as continuation of previous key=value line.
|
|
|
|
This commit ignores trailing blank lines. So newline characters
|
|
are trimmed out from the end of line.
|
|
---
|
|
libdnf/utils/iniparser/iniparser.cpp | 3 +++
|
|
1 file changed, 3 insertions(+)
|
|
|
|
diff --git a/libdnf/utils/iniparser/iniparser.cpp b/libdnf/utils/iniparser/iniparser.cpp
|
|
index c77c5ca..14fef74 100644
|
|
--- a/libdnf/utils/iniparser/iniparser.cpp
|
|
+++ b/libdnf/utils/iniparser/iniparser.cpp
|
|
@@ -81,6 +81,9 @@ IniParser::IniParser(std::unique_ptr<std::istream> && inputStream)
|
|
}
|
|
|
|
void IniParser::trimValue() noexcept {
|
|
+ auto end = value.find_last_not_of(DELIMITER);
|
|
+ if (end != value.npos)
|
|
+ value.resize(end + 1);
|
|
if (value.length() > 1 &&
|
|
value.front() == value.back() &&
|
|
(value.front() == '\"' || value.front() == '\'')) {
|
|
--
|
|
libgit2 0.28.2
|
|
|