From de6461f4a900e39bfe100465fce70903a57c6b35 Mon Sep 17 00:00:00 2001 From: bezzad Date: Wed, 18 Sep 2024 17:57:32 +0330 Subject: [PATCH] refactor ExceptionHelper.cs class --- src/Downloader/Extensions/Helpers/ExceptionHelper.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Downloader/Extensions/Helpers/ExceptionHelper.cs b/src/Downloader/Extensions/Helpers/ExceptionHelper.cs index cc5cf44..8d2d833 100644 --- a/src/Downloader/Extensions/Helpers/ExceptionHelper.cs +++ b/src/Downloader/Extensions/Helpers/ExceptionHelper.cs @@ -10,9 +10,7 @@ internal static class ExceptionHelper { internal static bool IsMomentumError(this Exception error) { - if (error.HasSource("System.Net.Http", - "System.Net.Sockets", - "System.Net.Security")) + if (error.HasSource("System.Net.Http", "System.Net.Sockets", "System.Net.Security")) return true; if (error.HasTypeOf(typeof(WebException), typeof(SocketException))) @@ -83,11 +81,11 @@ internal static bool CertificateValidationCallBack(object sender, // If the error is for certificate expiration then it can be continued return true; } - else if (certificate.Subject == certificate.Issuer && - status.Status == X509ChainStatusFlags.UntrustedRoot) + + if (status.Status == X509ChainStatusFlags.UntrustedRoot && + certificate.Subject == certificate.Issuer) { // Self-signed certificates with an untrusted root are valid. - continue; } else if (status.Status != X509ChainStatusFlags.NoError) { @@ -109,4 +107,4 @@ internal static bool CertificateValidationCallBack(object sender, return false; } } -} +} \ No newline at end of file