diff --git a/src/core/desktopfile/desktopfilereader.cpp b/src/core/desktopfile/desktopfilereader.cpp index 957eea5..7203ed2 100644 --- a/src/core/desktopfile/desktopfilereader.cpp +++ b/src/core/desktopfile/desktopfilereader.cpp @@ -95,8 +95,10 @@ namespace linuxdeploy { throw ParseError("Empty keys are not allowed"); // keys may only contain A-Za-z- characters according to specification - for (const auto c : key) { - if (!(c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c == '-')) + for (const char c : key) { + if (!( + (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || (c == '-') + )) throw ParseError("Key contains invalid character " + std::string{c}); } diff --git a/tests/core/test_desktopfile_conformance.cpp b/tests/core/test_desktopfile_conformance.cpp index 8f7529b..1b3107c 100644 --- a/tests/core/test_desktopfile_conformance.cpp +++ b/tests/core/test_desktopfile_conformance.cpp @@ -50,7 +50,7 @@ TEST_F(DesktopFileConformanceTest, testBasicFormatValidKeyCharacters) { ss << "[Desktop Entry]" << std::endl << "TestKey=foo" << std::endl; - EXPECT_THROW(DesktopFile file(ss), ParseError); + EXPECT_NO_THROW(DesktopFile file(ss)); } { @@ -58,7 +58,7 @@ TEST_F(DesktopFileConformanceTest, testBasicFormatValidKeyCharacters) { ss << "[Desktop Entry]" << std::endl << "4242trolol0=foo" << std::endl; - EXPECT_THROW(DesktopFile file(ss), ParseError); + EXPECT_NO_THROW(DesktopFile file(ss)); } { @@ -66,6 +66,14 @@ TEST_F(DesktopFileConformanceTest, testBasicFormatValidKeyCharacters) { ss << "[Desktop Entry]" << std::endl << "----=foo" << std::endl; - EXPECT_THROW(DesktopFile file(ss), ParseError); + EXPECT_NO_THROW(DesktopFile file(ss)); + } + + { + std::stringstream ss; + ss << "[Desktop Entry]" << std::endl + << "allLowerCase=foo" << std::endl; + + EXPECT_NO_THROW(DesktopFile file(ss)); } }