From ea24d038193dfb9ab11be5b35318709a2079e7bd Mon Sep 17 00:00:00 2001 From: David Colburn Date: Wed, 17 Apr 2024 13:12:26 -0700 Subject: [PATCH] fix s3 location when using custom endpoint (#656) --- pkg/pipeline/sink/uploader/s3.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/pipeline/sink/uploader/s3.go b/pkg/pipeline/sink/uploader/s3.go index aa9bd68d..01ead404 100644 --- a/pkg/pipeline/sink/uploader/s3.go +++ b/pkg/pipeline/sink/uploader/s3.go @@ -201,5 +201,10 @@ func (u *S3Uploader) upload(localFilepath, storageFilepath string, outputType ty return "", 0, wrap("S3", err) } - return fmt.Sprintf("https://%s.s3.amazonaws.com/%s", *u.bucket, storageFilepath), stat.Size(), nil + endpoint := "s3.amazonaws.com" + if u.awsConfig.Endpoint != nil { + endpoint = *u.awsConfig.Endpoint + } + + return fmt.Sprintf("https://%s.%s/%s", *u.bucket, endpoint, storageFilepath), stat.Size(), nil }