fix(api): fail fast on unexpected null document payload
This commit is contained in:
@@ -27,13 +27,7 @@ public sealed class DocumentsController(ISender sender) : ControllerBase
|
|||||||
public async Task<IActionResult> GetAsync([FromRoute] string id, CancellationToken cancellationToken)
|
public async Task<IActionResult> GetAsync([FromRoute] string id, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var response = await sender.Send(new GetDocumentQuery(id), cancellationToken);
|
var response = await sender.Send(new GetDocumentQuery(id), cancellationToken);
|
||||||
var data = response.Data;
|
var data = response.Data ?? throw new InvalidOperationException("Document payload is unexpectedly null.");
|
||||||
|
|
||||||
if (data is null)
|
|
||||||
{
|
|
||||||
return NotFound(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
return File(data.Content, data.ContentType, data.FileName);
|
return File(data.Content, data.ContentType, data.FileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,10 @@
|
|||||||
"Swagger": {
|
"Swagger": {
|
||||||
"EnabledInProduction": false
|
"EnabledInProduction": false
|
||||||
},
|
},
|
||||||
|
"Database": {
|
||||||
|
"CommandTimeoutSeconds": 30,
|
||||||
|
"WorkflowListingObjectType": "Ferdinand"
|
||||||
|
},
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Information",
|
"Default": "Information",
|
||||||
|
|||||||
Reference in New Issue
Block a user