From e05863dfe7db639cd81044a839e66b4277a2dc2b Mon Sep 17 00:00:00 2001 From: Vitalii Mikhailov Date: Sat, 12 Oct 2024 23:58:06 +0300 Subject: [PATCH] Better encoding detection? --- src/BUTR.CrashReport.Server.v13/JsonHandlerV13.cs | 2 +- src/BUTR.CrashReport.Server.v14/JsonHandlerV14.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BUTR.CrashReport.Server.v13/JsonHandlerV13.cs b/src/BUTR.CrashReport.Server.v13/JsonHandlerV13.cs index 10dc3a9..cfab1ca 100644 --- a/src/BUTR.CrashReport.Server.v13/JsonHandlerV13.cs +++ b/src/BUTR.CrashReport.Server.v13/JsonHandlerV13.cs @@ -68,7 +68,7 @@ public async Task UploadJsonAsync(ControllerBase controller, Canc { var tenant = byte.TryParse(controller.Request.Headers["Tenant"].ToString(), out var tenantId) ? tenantId : (byte) 1; - if (controller.Request.Headers.ContentEncoding.Any(x => x?.Equals("gzip,deflate", StringComparison.OrdinalIgnoreCase) == true)) + if (controller.Request.Headers.ContentEncoding is ["gzip", "deflate"] or ["gzip,deflate"] or ["gzip, deflate"]) controller.Request.Body = await _gZipCompressor.DecompressAsync(controller.Request.Body, ct); else controller.Request.EnableBuffering(); diff --git a/src/BUTR.CrashReport.Server.v14/JsonHandlerV14.cs b/src/BUTR.CrashReport.Server.v14/JsonHandlerV14.cs index d7c7b48..12b15f5 100644 --- a/src/BUTR.CrashReport.Server.v14/JsonHandlerV14.cs +++ b/src/BUTR.CrashReport.Server.v14/JsonHandlerV14.cs @@ -68,7 +68,7 @@ public async Task UploadJsonAsync(ControllerBase controller, Canc { var tenant = byte.TryParse(controller.Request.Headers["Tenant"].ToString(), out var tenantId) ? tenantId : (byte) 1; - if (controller.Request.Headers.ContentEncoding.Any(x => x?.Equals("gzip,deflate", StringComparison.OrdinalIgnoreCase) == true)) + if (controller.Request.Headers.ContentEncoding is ["gzip", "deflate"] or ["gzip,deflate"] or ["gzip, deflate"]) controller.Request.Body = await _gZipCompressor.DecompressAsync(controller.Request.Body, ct); else controller.Request.EnableBuffering();