You've already forked linuxdeploy
mirror of
https://github.com/encounter/linuxdeploy.git
synced 2026-07-10 12:18:44 -07:00
Fix basic format header checks
This commit is contained in:
@@ -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});
|
||||
}
|
||||
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user