Merge branch 'develop' into feedback-service
This commit is contained in:
@@ -365,7 +365,7 @@ namespace API::Subsonic
|
||||
void Response::JsonSerializer::serializeEscapedString(std::ostream& os, std::string_view str)
|
||||
{
|
||||
os << '\"';
|
||||
StringUtils::writeJSEscapedString(os, str);
|
||||
StringUtils::writeJsonEscapedString(os, str);
|
||||
os << '\"';
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,6 @@ namespace StringUtils
|
||||
{ '\r', "\\r" },
|
||||
{ '\t', "\\t" },
|
||||
{ '"', "\\\"" },
|
||||
{ '\'', "\\\'" },
|
||||
};
|
||||
|
||||
template <std::size_t N>
|
||||
|
||||
@@ -101,6 +101,22 @@ TEST(StringUtils, splitStringCopy)
|
||||
}
|
||||
}
|
||||
|
||||
TEST(StringUtils, escapeJSString)
|
||||
{
|
||||
EXPECT_EQ(StringUtils::jsEscape(""), "");
|
||||
EXPECT_EQ(StringUtils::jsEscape(R"(Test'.mp3)"), R"(Test\'.mp3)");
|
||||
EXPECT_EQ(StringUtils::jsEscape(R"(Test"".mp3)"), R"(Test\"\".mp3)");
|
||||
EXPECT_EQ(StringUtils::jsEscape(R"(\Test\.mp3)"), R"(\\Test\\.mp3)");
|
||||
}
|
||||
|
||||
TEST(StringUtils, escapeJsonString)
|
||||
{
|
||||
EXPECT_EQ(StringUtils::jsonEscape(""), "");
|
||||
EXPECT_EQ(StringUtils::jsonEscape(R"(Test'.mp3)"), R"(Test'.mp3)");
|
||||
EXPECT_EQ(StringUtils::jsonEscape(R"(Test"".mp3)"), R"(Test\"\".mp3)");
|
||||
EXPECT_EQ(StringUtils::jsonEscape(R"(\Test\.mp3)"), R"(\\Test\\.mp3)");
|
||||
}
|
||||
|
||||
TEST(StringUtils, escapeString)
|
||||
{
|
||||
EXPECT_EQ(StringUtils::escapeString("", "*", ' '), "");
|
||||
|
||||
Reference in New Issue
Block a user