mirror of
https://github.com/usememos/memos.git
synced 2025-03-03 16:53:30 +08:00
fix: s3 custom path (#1249)
This commit is contained in:
parent
e150599274
commit
31399fe475
1 changed files with 5 additions and 4 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue