Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

fix: s3 custom path (#1249)

boojack31399fe47546
diff --git a/plugin/storage/s3/s3.go b/plugin/storage/s3/s3.go
index e00e96052..58fed5cd7 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
}