From 99cc6aa32208ff07ed2e3b0da7bed849e9b5ad23 Mon Sep 17 00:00:00 2001 From: Thomas Anderson Date: Sun, 5 Jan 2025 09:26:24 +0000 Subject: [PATCH] Fixed the downloading issues and updated the downloads to include finalisations --- Btms.Backend/Endpoints/SyncEndpoints.cs | 2 +- Btms.Business/Commands/DownloadNotificationsCommand.cs | 6 ++++-- Btms.SensitiveData/SensitiveDataSerializer.cs | 5 +++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Btms.Backend/Endpoints/SyncEndpoints.cs b/Btms.Backend/Endpoints/SyncEndpoints.cs index 90727a26..888151c5 100644 --- a/Btms.Backend/Endpoints/SyncEndpoints.cs +++ b/Btms.Backend/Endpoints/SyncEndpoints.cs @@ -52,7 +52,7 @@ internal static async Task InitialiseEnvironment(IHost app, SyncPeriod private static IResult DownloadNotifications([FromServices] IWebHostEnvironment env, string id) { - var stream = File.OpenRead($"{Path.Combine(env.ContentRootPath, id)}.zip"); + var stream = File.OpenRead($"{env.ContentRootPath}/{id}.zip"); return Results.File(stream, "application/zip", $"{id}.zip", enableRangeProcessing: true); } diff --git a/Btms.Business/Commands/DownloadNotificationsCommand.cs b/Btms.Business/Commands/DownloadNotificationsCommand.cs index be1ac528..de00b9e7 100644 --- a/Btms.Business/Commands/DownloadNotificationsCommand.cs +++ b/Btms.Business/Commands/DownloadNotificationsCommand.cs @@ -39,8 +39,10 @@ public async Task Handle(DownloadCommand request, CancellationToken cancellation await Download(request, rootFolder, "RAW/GVMSAPIRESPONSE", typeof(SearchGmrsForDeclarationIdsResponse), cancellationToken); await Download(request, rootFolder, "RAW/DECISIONS", typeof(AlvsClearanceRequest), cancellationToken); - - ZipFile.CreateFromDirectory(rootFolder, $"{env.ContentRootPath}\\{request.JobId}.zip"); + + await Download(request, rootFolder, "RAW/FINALISATION", typeof(AlvsClearanceRequest), cancellationToken); + + ZipFile.CreateFromDirectory(rootFolder, $"{env.ContentRootPath}/{request.JobId}.zip"); Directory.Delete(rootFolder, true); } diff --git a/Btms.SensitiveData/SensitiveDataSerializer.cs b/Btms.SensitiveData/SensitiveDataSerializer.cs index ffd3aefa..eb8306ae 100644 --- a/Btms.SensitiveData/SensitiveDataSerializer.cs +++ b/Btms.SensitiveData/SensitiveDataSerializer.cs @@ -55,6 +55,11 @@ public string RedactRawJson(string json, Type type) } var sensitiveFields = SensitiveFieldsProvider.Get(type); + if (!sensitiveFields.Any()) + { + return json; + } + var rootNode = JsonNode.Parse(json); foreach (var sensitiveField in sensitiveFields)