Skip to content

Kavita is a fast, feature rich, cross platform reading server. Built with the goal of being a full solution for all your reading needs. Setup your own server and share your reading collection with your friends and family.

Fixed Parser.Parser.Normalize returns empty string (#991)

jeongsu816239b7c523d0f
diff --git a/API.Tests/Parser/ParserTest.cs b/API.Tests/Parser/ParserTest.cs
index 5068b39b3..1157fdab8 100644
--- a/API.Tests/Parser/ParserTest.cs
+++ b/API.Tests/Parser/ParserTest.cs
@@ -139,6 +139,7 @@ namespace API.Tests.Parser
[InlineData("Darker Than_Black", "darkerthanblack")]
[InlineData("Citrus", "citrus")]
[InlineData("Citrus+", "citrus+")]
+ [InlineData("카비타", "카비타")]
[InlineData("", "")]
public void NormalizeTest(string input, string expected)
{
diff --git a/API/Parser/Parser.cs b/API/Parser/Parser.cs
index f93035b31..742abe642 100644
--- a/API/Parser/Parser.cs
+++ b/API/Parser/Parser.cs
@@ -946,7 +946,8 @@ namespace API.Parser
public static string Normalize(string name)
{
- return NormalizeRegex.Replace(name, string.Empty).ToLower();
+ var normalized = NormalizeRegex.Replace(name, string.Empty).ToLower();
+ return string.IsNullOrEmpty(normalized) ? name : normalized;
}