feat: add URLSuffix resource option with S3 (#1428)

* feat: add URLSuffix resource option with S3

* feat: add URLSuffix resource option with S3

* fix: eslint
This commit is contained in:
Xudong Cai
2023-04-01 15:28:00 +08:00
committed by GitHub
parent 8eed9c267c
commit d21abfc60c
5 changed files with 17 additions and 1 deletions

View File

@ -20,6 +20,7 @@ type Config struct {
EndPoint string
Region string
URLPrefix string
URLSuffix string
}
type Client struct {
@ -67,7 +68,7 @@ func (client *Client) UploadFile(ctx context.Context, filename string, fileType
link := uploadOutput.Location
// If url prefix is set, use it as the file link.
if client.Config.URLPrefix != "" {
link = fmt.Sprintf("%s/%s", client.Config.URLPrefix, filename)
link = fmt.Sprintf("%s/%s%s", client.Config.URLPrefix, filename, client.Config.URLSuffix)
}
if link == "" {
return "", fmt.Errorf("failed to get file link")