From 7c0e8a1d042957c1b48eb50904b342cfc2adb755 Mon Sep 17 00:00:00 2001 From: Ronny Birkeli Date: Tue, 8 Aug 2023 07:49:37 +0200 Subject: [PATCH] Fixed missing await statement (#282) * Fixed missing await statement * Changed from array to string --------- Co-authored-by: Ronny Birkeli --- src/Altinn.App.Api/Controllers/DataController.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Altinn.App.Api/Controllers/DataController.cs b/src/Altinn.App.Api/Controllers/DataController.cs index 7103f0aa2..268637804 100644 --- a/src/Altinn.App.Api/Controllers/DataController.cs +++ b/src/Altinn.App.Api/Controllers/DataController.cs @@ -156,7 +156,7 @@ public async Task Create( (bool validationRestrictionSuccess, List errors) = DataRestrictionValidation.CompliesWithDataRestrictions(Request, dataTypeFromMetadata); if (!validationRestrictionSuccess) { - return new BadRequestObjectResult(GetErrorDetails(errors)); + return new BadRequestObjectResult(await GetErrorDetails(errors)); } StreamContent streamContent = Request.CreateContentStream(); @@ -182,7 +182,7 @@ public async Task Create( if (!fileValidationSuccess) { - return new BadRequestObjectResult(GetErrorDetails(validationIssues)); + return new BadRequestObjectResult(await GetErrorDetails(validationIssues)); } fileStream.Seek(0, SeekOrigin.Begin); @@ -205,7 +205,7 @@ public async Task Create( /// private async Task GetErrorDetails(List errors) { - return await _featureManager.IsEnabledAsync(FeatureFlags.JsonObjectInDataResponse) ? errors : errors.Select(x => x.Description); + return await _featureManager.IsEnabledAsync(FeatureFlags.JsonObjectInDataResponse) ? errors : string.Join(";", errors.Select(x => x.Description)); } private static bool FileAnalysisEnabledForDataType(DataType dataTypeFromMetadata) @@ -330,7 +330,7 @@ public async Task Put( (bool validationRestrictionSuccess, List errors) = DataRestrictionValidation.CompliesWithDataRestrictions(Request, dataTypeFromMetadata); if (!validationRestrictionSuccess) { - return new BadRequestObjectResult(GetErrorDetails(errors)); + return new BadRequestObjectResult(await GetErrorDetails(errors)); } return await PutBinaryData(instanceOwnerPartyId, instanceGuid, dataGuid);