Skip to content

Commit

Permalink
- Do not clean fragments for FTP(S)
Browse files Browse the repository at this point in the history
  • Loading branch information
KoalaBear84 committed Nov 24, 2021
1 parent 079ce91 commit beaad3f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 24 deletions.
5 changes: 4 additions & 1 deletion src/OpenDirectoryDownloader/DirectoryParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1950,7 +1950,10 @@ public static void CheckParsedResults(WebDirectory webDirectory, string baseUrl,
CheckParents(webDirectory, baseUrl);
}

CleanFragments(webDirectory);
if (webDirectory.Uri.Scheme != Constants.UriScheme.Ftp && webDirectory.Uri.Scheme != Constants.UriScheme.Ftps)
{
CleanFragments(webDirectory);
}

CleanDynamicEntries(webDirectory);

Expand Down
46 changes: 23 additions & 23 deletions src/OpenDirectoryDownloader/FtpParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,19 @@ public class FtpParser
private static bool IsMaxThreads(FtpCommandException ftpCommandException)
{
List<Regex> regexes = new List<Regex>
{
RegexMaxThreadsSpecific01,
RegexMaxThreadsSpecific02,
RegexMaxThreadsSpecific03,
RegexMaxThreadsSpecific04,

// General needs to be check the latest
RegexMaxThreadsGeneral01,
RegexMaxThreadsGeneral02,
RegexMaxThreadsGeneral03,
RegexMaxThreadsGeneral05,
RegexMaxThreadsGeneral06
};
{
RegexMaxThreadsSpecific01,
RegexMaxThreadsSpecific02,
RegexMaxThreadsSpecific03,
RegexMaxThreadsSpecific04,

// General needs to be check the latest
RegexMaxThreadsGeneral01,
RegexMaxThreadsGeneral02,
RegexMaxThreadsGeneral03,
RegexMaxThreadsGeneral05,
RegexMaxThreadsGeneral06
};

foreach (Regex regex in regexes)
{
Expand Down Expand Up @@ -144,11 +144,11 @@ public static async Task<WebDirectory> ParseFtpAsync(string processor, WebDirect
cancellationTokenSource.CancelAfter(TimeSpan.FromMinutes(5));

Context pollyContext = new Context
{
{ "Processor", processor },
{ "WebDirectory", webDirectory },
{ "CancellationTokenSource", cancellationTokenSource }
};
{
{ "Processor", processor },
{ "WebDirectory", webDirectory },
{ "CancellationTokenSource", cancellationTokenSource }
};

return (await RetryPolicyNew.ExecuteAndCaptureAsync(async (context, token) => { return await ParseFtpInnerAsync(processor, webDirectory, username, password, cancellationTokenSource.Token); }, pollyContext, cancellationTokenSource.Token)).Result;
}
Expand Down Expand Up @@ -248,11 +248,11 @@ public static async Task<string> GetFtpServerInfo(WebDirectory webDirectory, str
string processor = "Initalize";

Context pollyContext = new Context
{
{ "Processor", processor },
{ "WebDirectory", webDirectory },
{ "CancellationTokenSource", cancellationTokenSource }
};
{
{ "Processor", processor },
{ "WebDirectory", webDirectory },
{ "CancellationTokenSource", cancellationTokenSource }
};

return (await RetryPolicyNew.ExecuteAndCaptureAsync(async (context, token) => { return await GetFtpServerInfoInnerAsync(webDirectory, username, password, cancellationTokenSource.Token); }, pollyContext, cancellationTokenSource.Token)).Result;
}
Expand Down

0 comments on commit beaad3f

Please sign in to comment.