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:
Joseph Milazzo 2022-01-13 11:40:45 -08:00 committed by GitHub
parent f2bbdaaefc
commit 996c68d753
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 167 additions and 12 deletions

View file

@ -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();
}