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);