Skip to content

Commit

Permalink
Fixed missing await statement (#282)
Browse files Browse the repository at this point in the history
* Fixed missing await statement

* Changed from array to string

---------

Co-authored-by: Ronny Birkeli <ronny.birkeli@digdir.no>
  • Loading branch information
RonnyB71 and Ronny Birkeli authored Aug 8, 2023
1 parent 82cfc01 commit 7c0e8a1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Altinn.App.Api/Controllers/DataController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public async Task<ActionResult> Create(
(bool validationRestrictionSuccess, List<ValidationIssue> errors) = DataRestrictionValidation.CompliesWithDataRestrictions(Request, dataTypeFromMetadata);
if (!validationRestrictionSuccess)
{
return new BadRequestObjectResult(GetErrorDetails(errors));
return new BadRequestObjectResult(await GetErrorDetails(errors));
}

StreamContent streamContent = Request.CreateContentStream();
Expand All @@ -182,7 +182,7 @@ public async Task<ActionResult> Create(

if (!fileValidationSuccess)
{
return new BadRequestObjectResult(GetErrorDetails(validationIssues));
return new BadRequestObjectResult(await GetErrorDetails(validationIssues));
}

fileStream.Seek(0, SeekOrigin.Begin);
Expand All @@ -205,7 +205,7 @@ public async Task<ActionResult> Create(
/// </summary>
private async Task<object> GetErrorDetails(List<ValidationIssue> 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)
Expand Down Expand Up @@ -330,7 +330,7 @@ public async Task<ActionResult> Put(
(bool validationRestrictionSuccess, List<ValidationIssue> errors) = DataRestrictionValidation.CompliesWithDataRestrictions(Request, dataTypeFromMetadata);
if (!validationRestrictionSuccess)
{
return new BadRequestObjectResult(GetErrorDetails(errors));
return new BadRequestObjectResult(await GetErrorDetails(errors));
}

return await PutBinaryData(instanceOwnerPartyId, instanceGuid, dataGuid);
Expand Down

0 comments on commit 7c0e8a1

Please sign in to comment.