mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-07-09 03:04:19 -04:00
Fixed Parser.Parser.Normalize returns empty string (#991)
Parser.Parser.Normalize returns empty string when name doesn't have any alphanumeric characters. It messes up Series at least. To prevent this issue, if normalized string is empty, it just returns received name variable. In this case user has to carefully set file names but it is better than messed up Series.
This commit is contained in:
parent
83e91c758e
commit
239b7c523d
@ -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)
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user