diff options
author | 2022-01-04 17:37:54 +0100 | |
---|---|---|
committer | 2022-01-04 17:37:54 +0100 | |
commit | 7ebe0f6a15f1881e465b8e78bb8ef8b4982b00aa (patch) | |
tree | e8ddc08aa2eb8df937438fb72dd99690a9e81a6a /internal/media/manager.go | |
parent | return very partial image on first upload (diff) | |
download | gotosocial-7ebe0f6a15f1881e465b8e78bb8ef8b4982b00aa.tar.xz |
start working on thumb + full funcs
Diffstat (limited to 'internal/media/manager.go')
-rw-r--r-- | internal/media/manager.go | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/internal/media/manager.go b/internal/media/manager.go index 54b964564..074ebdb58 100644 --- a/internal/media/manager.go +++ b/internal/media/manager.go @@ -81,23 +81,22 @@ func (m *manager) ProcessMedia(ctx context.Context, data []byte, accountID strin switch mainType { case mimeImage: - if !supportedImage(contentType) { - return nil, fmt.Errorf("image type %s not supported", contentType) - } - if len(data) == 0 { - return nil, errors.New("image was of size 0") - } - media, err := m.preProcessImage(ctx, data, contentType, accountID) if err != nil { return nil, err } m.pool.Enqueue(func(innerCtx context.Context) { - + select { + case <-innerCtx.Done(): + // if the inner context is done that means the worker pool is closing, so we should just return + return + default: + media.PreLoad(innerCtx) + } }) - return nil, nil + return media, nil default: return nil, fmt.Errorf("content type %s not (yet) supported", contentType) } |