diff --git a/plugin/storage/s3/s3.go b/plugin/storage/s3/s3.go index e00e9605..58fed5cd 100644 --- a/plugin/storage/s3/s3.go +++ b/plugin/storage/s3/s3.go @@ -67,11 +67,12 @@ func (client *Client) UploadFile(ctx context.Context, filename string, fileType } link := uploadOutput.Location - if link == "" { - if client.Config.URLPrefix == "" { - return "", fmt.Errorf("url prefix is empty") - } + // If url prefix is set, use it as the file link. + if client.Config.URLPrefix != "" { link = fmt.Sprintf("%s/%s", client.Config.URLPrefix, filename) } + if link == "" { + return "", fmt.Errorf("failed to get file link") + } return link, nil }