Feature/parse scanned files tests (#934)
* Fixed a bug in CleanupBookmarks where the Except was deleting all files because the path separators didn't match. * Added unit tests for ParseScannedFiles.cs. * Fixed some unit tests. Parser will now clear out multiple spaces in a row and replace with a single.
This commit is contained in:
parent
f2bbdaaefc
commit
996c68d753
4 changed files with 167 additions and 12 deletions
|
@ -502,6 +502,11 @@ namespace API.Parser
|
|||
MatchOptions, RegexTimeout
|
||||
);
|
||||
|
||||
private static readonly Regex EmptySpaceRegex = new Regex(
|
||||
@"(?!=.+)(\s{2,})(?!=.+)",
|
||||
MatchOptions, RegexTimeout
|
||||
);
|
||||
|
||||
public static MangaFormat ParseFormat(string filePath)
|
||||
{
|
||||
if (IsArchive(filePath)) return MangaFormat.Archive;
|
||||
|
@ -841,6 +846,8 @@ namespace API.Parser
|
|||
title = title.Substring(1);
|
||||
}
|
||||
|
||||
title = EmptySpaceRegex.Replace(title, " ");
|
||||
|
||||
return title.Trim();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue