diff --git a/.gitignore b/.gitignore index 928e1ee53..4fbd82c72 100644 --- a/.gitignore +++ b/.gitignore @@ -501,3 +501,6 @@ API/stats/ UI/Web/dist/ /API.Tests/Extensions/Test Data/modified on run.txt /API/covers/ +API/config/covers/ +API/config/*.db +UI/Web/.vscode/settings.json diff --git a/API.Tests/Parser/ComicParserTests.cs b/API.Tests/Parser/ComicParserTests.cs index 5bd24f714..8ae63530b 100644 --- a/API.Tests/Parser/ComicParserTests.cs +++ b/API.Tests/Parser/ComicParserTests.cs @@ -56,6 +56,8 @@ namespace API.Tests.Parser [InlineData("Batgirl V2000 #57", "Batgirl")] [InlineData("Fables 021 (2004) (Digital) (Nahga-Empire)", "Fables")] [InlineData("2000 AD 0366 [1984-04-28] (flopbie)", "2000 AD")] + [InlineData("Daredevil - v6 - 10 - (2019)", "Daredevil")] + [InlineData("Batman - The Man Who Laughs #1 (2005)", "Batman - The Man Who Laughs")] public void ParseComicSeriesTest(string filename, string expected) { Assert.Equal(expected, API.Parser.Parser.ParseComicSeries(filename)); @@ -93,6 +95,7 @@ namespace API.Tests.Parser [InlineData("Fables 021 (2004) (Digital) (Nahga-Empire).cbr", "0")] [InlineData("Cyberpunk 2077 - Trauma Team 04.cbz", "0")] [InlineData("2000 AD 0366 [1984-04-28] (flopbie)", "0")] + [InlineData("Daredevil - v6 - 10 - (2019)", "6")] public void ParseComicVolumeTest(string filename, string expected) { Assert.Equal(expected, API.Parser.Parser.ParseComicVolume(filename)); @@ -134,6 +137,7 @@ namespace API.Tests.Parser [InlineData("Fables 021 (2004) (Digital) (Nahga-Empire).cbr", "21")] [InlineData("Cyberpunk 2077 - Trauma Team #04.cbz", "4")] [InlineData("2000 AD 0366 [1984-04-28] (flopbie)", "366")] + [InlineData("Daredevil - v6 - 10 - (2019)", "10")] public void ParseComicChapterTest(string filename, string expected) { Assert.Equal(expected, API.Parser.Parser.ParseComicChapter(filename)); @@ -172,10 +176,26 @@ namespace API.Tests.Parser FullFilePath = filepath, IsSpecial = false }); + filepath = @"E:\Comics\Comics\Publisher\Batman the Detective (2021)\Batman the Detective - v6 - 11 - (2021).cbr"; + expected.Add(filepath, new ParserInfo + { + Series = "Batman the Detective", Volumes = "6", Edition = "", + Chapters = "11", Filename = "Batman the Detective - v6 - 11 - (2021).cbr", Format = MangaFormat.Archive, + FullFilePath = filepath, IsSpecial = false + }); + + filepath = @"E:\Comics\Comics\Batman - The Man Who Laughs #1 (2005)\Batman - The Man Who Laughs #1 (2005).cbr"; + expected.Add(filepath, new ParserInfo + { + Series = "Batman - The Man Who Laughs", Volumes = "0", Edition = "", + Chapters = "1", Filename = "Batman - The Man Who Laughs #1 (2005).cbr", Format = MangaFormat.Archive, + FullFilePath = filepath, IsSpecial = false + }); + foreach (var file in expected.Keys) { var expectedInfo = expected[file]; - var actual = API.Parser.Parser.Parse(file, rootPath); + var actual = API.Parser.Parser.Parse(file, rootPath, LibraryType.Comic); if (expectedInfo == null) { Assert.Null(actual); diff --git a/API/Services/DirectoryService.cs b/API/Services/DirectoryService.cs index c850e9084..fd1256e49 100644 --- a/API/Services/DirectoryService.cs +++ b/API/Services/DirectoryService.cs @@ -375,8 +375,11 @@ namespace API.Services IEnumerable subDirs; string[] files; - try { - subDirs = Directory.GetDirectories(currentDir).Where(path => ExcludeDirectories.Matches(path).Count == 0); + try + { + // Default EnumerationOptions will ignore system and hidden folders + subDirs = Directory.GetDirectories(currentDir, "*", new EnumerationOptions()) + .Where(path => ExcludeDirectories.Matches(path).Count == 0); } // Thrown if we do not have discovery permission on the directory. catch (UnauthorizedAccessException e) { diff --git a/API/Startup.cs b/API/Startup.cs index da8f24582..1eebf2d09 100644 --- a/API/Startup.cs +++ b/API/Startup.cs @@ -106,6 +106,11 @@ namespace API services.AddResponseCaching(); + services.Configure(options => + { + options.ForwardedHeaders = + ForwardedHeaders.All; + }); services.AddHangfire(configuration => configuration .UseSimpleAssemblyNameTypeSerializer() @@ -140,7 +145,7 @@ namespace API app.UseForwardedHeaders(new ForwardedHeadersOptions { - ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto + ForwardedHeaders = ForwardedHeaders.All }); app.UseRouting();