From 884e85ef360ab1704448240083d7a50699c5c762 Mon Sep 17 00:00:00 2001 From: KoalaBear Date: Sun, 12 Jul 2020 22:56:59 +0200 Subject: [PATCH] - Added extra fix for The Trove for checking if the correct directory is returned, and do not trim anymore because everything can start AND end with a space.. --- OpenDirectoryDownloader/DirectoryParser.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenDirectoryDownloader/DirectoryParser.cs b/OpenDirectoryDownloader/DirectoryParser.cs index 7058713e..3cd4d613 100644 --- a/OpenDirectoryDownloader/DirectoryParser.cs +++ b/OpenDirectoryDownloader/DirectoryParser.cs @@ -492,7 +492,7 @@ private static WebDirectory ParseSnifDirectoryListing(string baseUrl, WebDirecto private static WebDirectory ParsePureDirectoryListing(ref string baseUrl, WebDirectory parsedWebDirectory, IHtmlDocument htmlDocument, IHtmlCollection pureTableRows) { - string urlFromBreadcrumbs = Uri.EscapeUriString(string.Join("/", htmlDocument.QuerySelectorAll(".breadcrumbs_main .breadcrumb").Where(b => !b.ClassList.Contains("smaller")).Select(b => b.TextContent.Trim())) + "/"); + string urlFromBreadcrumbs = Uri.EscapeUriString(string.Join("/", htmlDocument.QuerySelectorAll(".breadcrumbs_main .breadcrumb").Where(b => !b.ClassList.Contains("smaller")).Select(b => b.TextContent)) + "/"); // Remove possible file part (index.html) from url if (!string.IsNullOrWhiteSpace(Path.GetFileName(WebUtility.UrlDecode(baseUrl)))) @@ -504,7 +504,7 @@ private static WebDirectory ParsePureDirectoryListing(ref string baseUrl, WebDir string urlFromBaseUrl = baseUrl.Remove(0, new Uri(baseUrl).Scheme.Length + new Uri(baseUrl).Host.Length + 3).Replace("/.", "/"); urlFromBaseUrl = urlFromBaseUrl.Replace("%23", "#"); - if (urlFromBreadcrumbs == urlFromBaseUrl) + if (urlFromBreadcrumbs == urlFromBaseUrl || urlFromBreadcrumbs == Uri.EscapeUriString(urlFromBaseUrl)) { IElement table = pureTableRows.First().Parent("table");