From c223c7598dcd44db9befcce8fb49c6dbbcfac36d Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Sun, 12 Feb 2023 14:42:28 +0100 Subject: [bugfix] Set appropriate cache-control when using presigned s3 links (#1480) --- internal/processing/media/getfile.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'internal/processing') 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)) -- cgit v1.2.3