summaryrefslogtreecommitdiff
path: root/internal/processing/media/getfile.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2023-02-12 14:42:28 +0100
committerLibravatar GitHub <noreply@github.com>2023-02-12 14:42:28 +0100
commitc223c7598dcd44db9befcce8fb49c6dbbcfac36d (patch)
treeb876545c0adf1e0e63584a9f52df11376ea918e8 /internal/processing/media/getfile.go
parent[chore/performance] Update media prune logic, add extra CLI command (#1474) (diff)
downloadgotosocial-c223c7598dcd44db9befcce8fb49c6dbbcfac36d.tar.xz
[bugfix] Set appropriate cache-control when using presigned s3 links (#1480)
Diffstat (limited to 'internal/processing/media/getfile.go')
-rw-r--r--internal/processing/media/getfile.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/internal/processing/media/getfile.go b/internal/processing/media/getfile.go
index 9501706fb..9843d6714 100644
--- a/internal/processing/media/getfile.go
+++ b/internal/processing/media/getfile.go
@@ -232,10 +232,13 @@ func (p *processor) getEmojiContent(ctx context.Context, fileName string, owning
}
func (p *processor) retrieveFromStorage(ctx context.Context, storagePath string, content *apimodel.Content) (*apimodel.Content, gtserror.WithCode) {
+ // If running on S3 storage with proxying disabled then
+ // just fetch a pre-signed URL instead of serving the content.
if url := p.storage.URL(ctx, storagePath); url != nil {
content.URL = url
return content, nil
}
+
reader, err := p.storage.GetStream(ctx, storagePath)
if err != nil {
return nil, gtserror.NewErrorNotFound(fmt.Errorf("error retrieving from storage: %s", err))