fix(attachment): check download variant and readiness
This commit is contained in:
@@ -23,6 +23,7 @@ import (
|
||||
|
||||
var (
|
||||
ErrAttachmentNotFound = errors.New("attachment not found")
|
||||
ErrAttachmentNotReady = errors.New("attachment not ready")
|
||||
ErrInvalidImage = errors.New("invalid image")
|
||||
ErrInvalidSize = errors.New("invalid size")
|
||||
ErrUploadReadTimeout = errors.New("upload body read timed out")
|
||||
@@ -203,6 +204,10 @@ func (s *AttachmentService) GetContent(
|
||||
return nil, "", err
|
||||
}
|
||||
|
||||
if model.AttachmentStatus(row.Status) != model.AttachmentStatusReady {
|
||||
return nil, "", ErrAttachmentNotReady
|
||||
}
|
||||
|
||||
out, err := s.s3.Get(ctx, row.S3Key)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
|
||||
@@ -20,7 +20,6 @@ import (
|
||||
|
||||
var (
|
||||
ErrMessageChatNotFound = errors.New("chat not found")
|
||||
ErrAttachmentNotReady = errors.New("attachment not ready")
|
||||
ErrIdempotencyKeyConflict = errors.New("idempotency key reused with different request")
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user