summaryrefslogtreecommitdiff
path: root/internal/processing/media/create.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/processing/media/create.go')
-rw-r--r--internal/processing/media/create.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/internal/processing/media/create.go b/internal/processing/media/create.go
index b8c469dde..fe20457b4 100644
--- a/internal/processing/media/create.go
+++ b/internal/processing/media/create.go
@@ -42,18 +42,18 @@ func (p *Processor) Create(ctx context.Context, account *gtsmodel.Account, form
}
// process the media attachment and load it immediately
- media, err := p.mediaManager.PreProcessMedia(ctx, data, account.ID, &media.AdditionalMediaInfo{
+ media := p.mediaManager.PreProcessMedia(data, account.ID, &media.AdditionalMediaInfo{
Description: &form.Description,
FocusX: &focusX,
FocusY: &focusY,
})
- if err != nil {
- return nil, gtserror.NewErrorUnprocessableEntity(err)
- }
attachment, err := media.LoadAttachment(ctx)
if err != nil {
- return nil, gtserror.NewErrorUnprocessableEntity(err)
+ return nil, gtserror.NewErrorUnprocessableEntity(err, err.Error())
+ } else if attachment.Type == gtsmodel.FileTypeUnknown {
+ err = gtserror.Newf("could not process uploaded file with extension %s", attachment.File.ContentType)
+ return nil, gtserror.NewErrorUnprocessableEntity(err, err.Error())
}
apiAttachment, err := p.converter.AttachmentToAPIAttachment(ctx, attachment)