PluginUtility: Fix PerfData don't get parsed correctly

The problem was that some PerfData labels contained several whitespace characters,
not just one, and therefore it was parsed incorrectly in `SplitPerfdata()`. I.e. the condition
in line 144 checks whether the first and last character is a normal quote, but since the
label can contain spaces at the beginning and at the end respectively, this caused the problems.

This PR fixes the problem by removing all occurring whitespace from the beginning and end,
before starting to parse the actual label.
This commit is contained in:
Yonas Habteab 2021-08-10 16:42:12 +02:00 committed by Yonas Habteab
parent 66b039df9c
commit 24d95e1178
1 changed files with 1 additions and 0 deletions

View File

@ -140,6 +140,7 @@ Array::Ptr PluginUtility::SplitPerfdata(const String& perfdata)
break;
String label = perfdata.SubStr(begin, eqp - begin);
boost::algorithm::trim_left(label);
if (label.GetLength() > 2 && label[0] == '\'' && label[label.GetLength() - 1] == '\'')
label = label.SubStr(1, label.GetLength() - 2);