diff options
author | Michael Pyne <mpyne@kde.org> | 2017-08-06 22:18:36 -0400 |
---|---|---|
committer | Michael Pyne <mpyne@kde.org> | 2017-08-08 23:40:45 -0400 |
commit | 11ee92d92b1e9875a2707848324012fe881bf893 (patch) | |
tree | 978031be66bd2d5d8c8d20d28de457e35b5188af | |
parent | 4f096fd6466a8b5d1e05bbae593f3028fb4ef65a (diff) | |
download | kconfig-11ee92d92b1e9875a2707848324012fe881bf893.tar.gz kconfig-11ee92d92b1e9875a2707848324012fe881bf893.tar.bz2 |
kconfigini: Strip leading whitespace when reading entry values.
As per the Desktop Entry spec, we strip trailing whitespace from the key
when we split an entry into a key/value pair at the '='. Now we also
strip leading whitespace from the resulting value like we should.
CCBUG:310674
Differential Revision: https://phabricator.kde.org/D7169
-rw-r--r-- | autotests/kdesktopfiletest.cpp | 6 | ||||
-rw-r--r-- | src/core/kconfigini.cpp | 1 |
2 files changed, 4 insertions, 3 deletions
diff --git a/autotests/kdesktopfiletest.cpp b/autotests/kdesktopfiletest.cpp index a0461964..55e92569 100644 --- a/autotests/kdesktopfiletest.cpp +++ b/autotests/kdesktopfiletest.cpp @@ -43,10 +43,10 @@ void KDesktopFileTest::testRead() QTextStream ts(&file); ts << "[Desktop Entry]\n" - "Type=Application\n" + "Type= Application\n" "Name=My Application\n" - "Icon=foo\n" - "MimeType=text/plain;image/png;\n" + "Icon = foo\n" + "MimeType =text/plain;image/png;\n" "\n"; file.close(); QVERIFY(QFile::exists(fileName)); diff --git a/src/core/kconfigini.cpp b/src/core/kconfigini.cpp index a5ecc00d..211b630e 100644 --- a/src/core/kconfigini.cpp +++ b/src/core/kconfigini.cpp @@ -193,6 +193,7 @@ KConfigIniBackend::parseConfig(const QByteArray ¤tLocale, KEntryMap &entry temp.trim(); aKey = temp; line.truncateLeft(eqpos + 1); + line.trim(); } if (aKey.isEmpty()) { qWarning() << warningProlog(file, lineNo) << "Invalid entry (empty key)"; |