为什么:候选环境改用真实 WeKnora 表结构后,暴露出多处"按猜的列名/形状"的假设, 以及若干 varchar 长度、对象定位符、空索引基线问题,导致真实链路跑不通。 - knowledge_tag_relations 无 tenant_id/KB 列 → 归属走父表;resources 作用域=绑定+chunk 引用。 - 写入顺序按真实外键;无代理键表用内容摘要核对。 - 队列作业 ID / 版本记录 ID 改固定长度摘要(列宽 varchar(36)/varchar(64))。 - 对象定位符拆 storage://<backend>/oss://<bucket>/<key>;provider 可配置。 - 空索引基线全链路一致(Current/Export/Backup/Archive),非空仍严格比对映射。 - finalize 阶段:版本登记失败不报成功;崩溃接管复用已持久化预备份。 - 迁移 000069:同一目标的 sync/restore 跨 kind 互斥。
This commit is contained in:
@@ -493,6 +493,11 @@ func validSQLIdentifier(value string) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// validObjectLocator 接受两种真实形态:
|
||||
// - 无 scheme 的对象键:"weknora/10000/<doc>/<file>.docx"
|
||||
// - 带 scheme 的定位符:"oss://<bucket>/<key>"(WeKnora 的资源路径就是这个形状)
|
||||
//
|
||||
// 只校验结构,不改值;真正的 bucket/key 拆分由 providerPathFromLocator 做。
|
||||
func validObjectLocator(value string) bool {
|
||||
if value == "" || len(value) > 2048 || value != strings.TrimSpace(value) || strings.ContainsAny(value, "\x00\r\n\\?#") || strings.HasPrefix(value, "/") {
|
||||
return false
|
||||
@@ -501,7 +506,12 @@ func validObjectLocator(value string) bool {
|
||||
if !validSearchIdentifier(value[:separator]) {
|
||||
return false
|
||||
}
|
||||
value = value[separator+3:]
|
||||
remainder := value[separator+3:]
|
||||
boundary := strings.Index(remainder, "/")
|
||||
if boundary <= 0 || !validSearchIdentifier(remainder[:boundary]) {
|
||||
return false
|
||||
}
|
||||
value = remainder[boundary+1:]
|
||||
}
|
||||
cleaned := path.Clean(value)
|
||||
return cleaned == value && cleaned != "." && cleaned != ".." && !strings.HasPrefix(cleaned, "../")
|
||||
|
||||
Reference in New Issue
Block a user