mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
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:
@ -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")
|
||||
|
Reference in New Issue
Block a user