Skip to content

Commit

Permalink
fix(api/img-upload): public_path config enables the use of full url (
Browse files Browse the repository at this point in the history
  • Loading branch information
qwqcode committed Dec 16, 2023
1 parent c9ea8f6 commit 103713a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion server/handler/img_upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,15 @@ func ImgUpload(app *core.App, router fiber.Router) {
if baseURL == "" {
baseURL = config.IMG_UPLOAD_PUBLIC_PATH
}
imgURL := path.Join(baseURL, filename)

var imgURL string
if utils.ValidateURL(baseURL) {
// full url
imgURL = strings.TrimSuffix(baseURL, "/") + "/" + filename
} else {
// relative path
imgURL = path.Join(baseURL, filename)
}

// 使用 upgit
if app.Conf().ImgUpload.Upgit.Enabled {
Expand Down

0 comments on commit 103713a

Please sign in to comment.