Fix errorneous whitespace handling in Desktop Entry parsing from KConfigIni
ClosedPublic

Authored by mpyne on Aug 7 2017, 1:44 AM.

Details

Summary

As reported in bug 310674, the Desktop Entry spec says that whitespace surrounding the = sign that separates the key and value in .desktop files should be ignored when interpreting the key and value portions.

That is, all four of these lines should be equivalent:

Type=Application
Type =Application
Type= Application
Type = Application

KConfigIni already handles this for the key (by calling .trim on the value that is assigned to aKey), but neglects to do so for the value. This patch fixes this so that reading .desktop files through KConfigIni should be standards-compliant.

Test Plan

The patch includes a modification to the existing autotests which fail with the old code, and pass with the updated code. A separate test is not added, but instead I added spaces to parts of the existing test .desktop files, as this is enough to exercise the new code.

Diff Detail

Repository
R237 KConfig
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
mpyne created this revision.Aug 7 2017, 1:44 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptAug 7 2017, 1:44 AM
cfeck added a subscriber: cfeck.EditedAug 7 2017, 1:52 AM

That also trims trailing spaces in value ...

(and I am surprised the fix is not at the location where the TODO comment is)
EDIT: ah, this is for kconfig, not kcoreaddons...

apol accepted this revision.Aug 7 2017, 2:22 AM
This revision is now accepted and ready to land.Aug 7 2017, 2:22 AM
This revision was automatically updated to reflect the committed changes.