fix: 注册 user-rules 和 shensheshou 路由,修复规则配置保存失败
- 将 /api/db/user-rules 的 GET/POST/PUT/DELETE 路由注册到 db 组 - 将 /api/admin/shensheshou/* 的 4 个路由注册到 admin 组 - 包含上次对话的头像 URL 修复(normalizeImageUrl 全栈) Made-with: Cursor
This commit is contained in:
@@ -84,7 +84,18 @@ func ossUploadFile(file multipart.File, folder, filename string) (string, error)
|
||||
}
|
||||
return host + "/" + objectKey, nil
|
||||
}
|
||||
return signedURL, nil
|
||||
return normalizeOSSUrl(signedURL), nil
|
||||
}
|
||||
|
||||
// normalizeOSSUrl 修复 OSS SDK 可能返回的缺少冒号的 URL(如 "https//..." → "https://...")
|
||||
func normalizeOSSUrl(u string) string {
|
||||
if strings.HasPrefix(u, "https//") {
|
||||
return "https://" + u[7:]
|
||||
}
|
||||
if strings.HasPrefix(u, "http//") {
|
||||
return "http://" + u[6:]
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func ossUploadBytes(data []byte, folder, filename, contentType string) (string, error) {
|
||||
@@ -133,5 +144,5 @@ func ossUploadBytes(data []byte, folder, filename, contentType string) (string,
|
||||
}
|
||||
return host + "/" + objectKey, nil
|
||||
}
|
||||
return signedURL, nil
|
||||
return normalizeOSSUrl(signedURL), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user