diff --git a/EnvelopeGenerator.Application/Envelopes/Queries/ReadSingleEnvelopeDocResultQuery.cs b/EnvelopeGenerator.Application/Envelopes/Queries/ReadSingleEnvelopeDocResultQuery.cs
index f2bb0f0e..fd8451d7 100644
--- a/EnvelopeGenerator.Application/Envelopes/Queries/ReadSingleEnvelopeDocResultQuery.cs
+++ b/EnvelopeGenerator.Application/Envelopes/Queries/ReadSingleEnvelopeDocResultQuery.cs
@@ -1,5 +1,4 @@
using MediatR;
-using EnvelopeGenerator.Application.Common.Query;
using EnvelopeGenerator.Application.Common.Dto;
using DigitalData.Core.Exceptions;
@@ -8,7 +7,7 @@ namespace EnvelopeGenerator.Application.Envelopes.Queries;
///
/// Repräsentiert eine Abfrage für Umschläge.
///
-public record ReadSingleEnvelopeDocResultQuery() : EnvelopeQueryBase, IRequest
+public record ReadSingleEnvelopeDocResultQuery() : IRequest
{
///
///
@@ -41,6 +40,8 @@ public class ReadSingleEnvelopeDocResultQueryHandler : IRequestHandler Handle(ReadSingleEnvelopeDocResultQuery request, CancellationToken cancellationToken)
{
var result = await _mediator.Send(request.Envelope, cancellationToken);
- return result.DocResult ?? throw new NotFoundException($"Document for Envelope with ID {request.Envelope.Id} not found");
+ return result.DocResult is byte[] docResult && docResult.Length > 0
+ ? docResult
+ : throw new NotFoundException($"Document for Envelope with ID {request.Envelope.Id} not found");
}
}
\ No newline at end of file