Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

修改exportResources这个API的参数 (#10855)

小小飞同学ffc8b41c50d9
diff --git a/kernel/api/export.go b/kernel/api/export.go
index 9acb9f0f69..e0b46dbdc3 100644
--- a/kernel/api/export.go
+++ b/kernel/api/export.go
@@ -283,11 +283,16 @@ func exportResources(c *gin.Context) {
name = time.Now().Format("export-2006-01-02_15-04-05") // 生成的 *.zip 文件主文件名
}
+ if arg["paths"] == nil {
+ ret.Code = 1
+ ret.Data = ""
+ ret.Msg = "paths is required"
+ return
+ }
+
var resourcePaths []string // 文件/文件夹在工作空间中的路径
- if nil != arg["paths"] {
- for _, resourcePath := range arg["paths"].([]interface{}) {
- resourcePaths = append(resourcePaths, resourcePath.(string))
- }
+ for _, resourcePath := range arg["paths"].([]interface{}) {
+ resourcePaths = append(resourcePaths, resourcePath.(string))
}
zipFilePath, err := model.ExportResources(resourcePaths, name)