diff options
author | 2024-09-26 12:43:10 +0000 | |
---|---|---|
committer | 2024-09-26 14:43:10 +0200 | |
commit | 53ee6aef0885b4055ef95bf4f20ee78fd381e333 (patch) | |
tree | a181b038dc969482b34690603328dd6b756a42fb /internal/media/processingemoji.go | |
parent | [chore] reduce number admin process workers (#3354) (diff) | |
download | gotosocial-53ee6aef0885b4055ef95bf4f20ee78fd381e333.tar.xz |
[bugfix] s3 media uploaded without content-type (#3353)
* update go-storage dependency, for S3Storage manually call PutObject() so we can set content-type
* update calls to PutFile() to include the contentType
Diffstat (limited to 'internal/media/processingemoji.go')
-rw-r--r-- | internal/media/processingemoji.go | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/internal/media/processingemoji.go b/internal/media/processingemoji.go index 89a1bcc91..18d7895fd 100644 --- a/internal/media/processingemoji.go +++ b/internal/media/processingemoji.go @@ -216,10 +216,18 @@ func (p *ProcessingEmoji) store(ctx context.Context) error { "png", ) + // Get mimetype for the file container + // type, falling back to generic data. + p.emoji.ImageContentType = getMimeType(ext) + + // Set the known emoji static content type. + p.emoji.ImageStaticContentType = "image/png" + // Copy temporary file into storage at path. filesz, err := p.mgr.state.Storage.PutFile(ctx, p.emoji.ImagePath, temppath, + p.emoji.ImageContentType, ) if err != nil { return gtserror.Newf("error writing emoji to storage: %w", err) @@ -229,6 +237,7 @@ func (p *ProcessingEmoji) store(ctx context.Context) error { staticsz, err := p.mgr.state.Storage.PutFile(ctx, p.emoji.ImageStaticPath, staticpath, + p.emoji.ImageStaticContentType, ) if err != nil { return gtserror.Newf("error writing static to storage: %w", err) @@ -256,13 +265,6 @@ func (p *ProcessingEmoji) store(ctx context.Context) error { "png", ) - // Get mimetype for the file container - // type, falling back to generic data. - p.emoji.ImageContentType = getMimeType(ext) - - // Set the known emoji static content type. - p.emoji.ImageStaticContentType = "image/png" - // We can now consider this cached. p.emoji.Cached = util.Ptr(true) |