An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: 改进导入 data.zip 和 .sy.zip 校验失败时的提示 Fix https://github.com/siyuan-note/siyuan/issues/7738
Liang Ding5edf5e686de3
diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.jsonindex 7cce4bd064..94b108e5ff 100644--- a/app/appearance/langs/en_US.json+++ b/app/appearance/langs/en_US.json@@ -1122,6 +1122,8 @@"194": "There are restrictions on the Nutstore interface, please use other WebDAV services","195": "The system time is incorrect, please calibrate the system time and try again","196": "Do not set the workspace under the path of a third-party sync disk, otherwise the data will be damaged (iCloud/OneDrive/Dropbox/Google Drive/Nutstore/Baidu Netdisk/Tencent Weiyun, etc.)",- "197": "Currently the editor is in read-only mode. If you need to edit content, please switch to edit mode"+ "197": "Currently the editor is in read-only mode. If you need to edit content, please switch to edit mode",+ "198": "This is not a valid Data archive. If the archive was exported from [Doc tree], please import it from [Doc tree]",+ "199": "This is not a valid .sy.zip archive. If the archive was exported from [Settings], please import it from [Settings]"}}diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.jsonindex e753ef690a..9487f5ade4 100644--- a/app/appearance/langs/es_ES.json+++ b/app/appearance/langs/es_ES.json@@ -1122,6 +1122,8 @@"194": "Existen restricciones en la interfaz de Nutstore, utilice otros servicios WebDAV","195": "La hora del sistema es incorrecta, calibre la hora del sistema y vuelva a intentarlo","196": "No configure el espacio de trabajo bajo la ruta de un disco de sincronización de terceros, de lo contrario, los datos se dañarán (iCloud/OneDrive/Dropbox/Google Drive/Nutstore/Baidu Netdisk/Tencent Weiyun, etc.)",- "197": "Actualmente, el editor se encuentra en modo de solo lectura. Si necesita editar contenido, cambie al modo de edición"+ "197": "Actualmente, el editor se encuentra en modo de solo lectura. Si necesita editar contenido, cambie al modo de edición",+ "198": "Este no es un archivo data.zip válido. Si el archivo se exportó de [Árbol de documentos], importalo de [Árbol de documentos]",+ "199": "Este no es un archivo .sy.zip válido. Si el archivo se exportó desde [Configuración], impórtelo desde [Configuración]"}}diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.jsonindex b7a8c6ac1a..403bb2ad03 100644--- a/app/appearance/langs/fr_FR.json+++ b/app/appearance/langs/fr_FR.json@@ -1122,6 +1122,8 @@"194": "Il existe des restrictions sur l'interface Nutstore, veuillez utiliser d'autres services WebDAV","195": "L'heure du système est incorrecte, veuillez calibrer l'heure du système et réessayer","196": "Ne définissez pas l'espace de travail sous le chemin d'un disque de synchronisation tiers, sinon les données seront endommagées (iCloud/OneDrive/Dropbox/Google Drive/Nutstore/Baidu Netdisk/Tencent Weiyun, etc.)",- "197": "Actuellement, l'éditeur est en mode lecture seule. Si vous devez modifier le contenu, veuillez passer en mode édition"+ "197": "Actuellement, l'éditeur est en mode lecture seule. Si vous devez modifier le contenu, veuillez passer en mode édition",+ "198": "Ceci n'est pas une archive data.zip valide. Si l'archive a été exportée depuis [Doc tree], veuillez l'importer depuis [Doc tree]",+ "199": "Ceci n'est pas une archive .sy.zip valide. Si l'archive a été exportée depuis [Paramètres], veuillez l'importer depuis [Paramètres]"}}diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.jsonindex e884dcc267..3a52f4eab1 100644--- a/app/appearance/langs/zh_CHT.json+++ b/app/appearance/langs/zh_CHT.json@@ -1122,6 +1122,8 @@"194": "堅果雲接口存在限制,請使用其他 WebDAV 服務","195": "系統時間不正確,請校準系統時間後再試","196": "請勿將工作空間設置在第三方同步盤路徑下,否則數據會被損壞(iCloud/OneDrive/Dropbox/Google Drive/堅果雲/百度網盤/騰訊微雲等)",- "197": "目前編輯器正處於只讀模式狀態,如果需要編輯內容,請切換到編輯模式"+ "197": "目前編輯器正處於只讀模式狀態,如果需要編輯內容,請切換到編輯模式",+ "198": "這不是一個有效的 Data 壓縮包。如果該數據包是從 [文檔樹] 導出的,請從 [文檔樹] 導入",+ "199": "這不是一個有效的 .sy.zip 壓縮包。如果該數據包是從 [設置] 中導出的,請從 [設置] 中導入"}}diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.jsonindex 167c32fd71..992746df16 100644--- a/app/appearance/langs/zh_CN.json+++ b/app/appearance/langs/zh_CN.json@@ -1122,6 +1122,8 @@"194": "坚果云接口存在限制,请使用其他 WebDAV 服务","195": "系统时间不正确,请校准系统时间后再试","196": "请勿将工作空间设置在第三方同步盘路径下,否则数据会被损坏(iCloud/OneDrive/Dropbox/Google Drive/坚果云/百度网盘/腾讯微云等)",- "197": "目前编辑器正处于只读模式状态,如果需要编辑内容,请切换到编辑模式"+ "197": "目前编辑器正处于只读模式状态,如果需要编辑内容,请切换到编辑模式",+ "198": "这不是一个有效的 Data 压缩包。如果该数据包是从 [文档树] 导出的,请从 [文档树] 导入",+ "199": "这不是一个有效的 .sy.zip 压缩包。如果该数据包是从 [设置] 中导出的,请从 [设置] 中导入"}}diff --git a/kernel/model/import.go b/kernel/model/import.goindex 37b314217c..4fa1f52a28 100644--- a/kernel/model/import.go+++ b/kernel/model/import.go@@ -112,7 +112,7 @@ func ImportSY(zipPath, boxID, toPath string) (err error) {}if 1 != len(unzipRootPaths) {logging.LogErrorf("invalid .sy.zip")- return errors.New("invalid .sy.zip")+ return errors.New(Conf.Language(199))}unzipRootPath := unzipRootPaths[0]luteEngine := util.NewLute()@@ -422,7 +422,7 @@ func ImportData(zipPath string) (err error) {return errors.New("check data.zip failed")}if 0 < len(files) {- return errors.New("invalid data.zip")+ return errors.New(Conf.Language(198))}dirs, err := os.ReadDir(unzipPath)if nil != err {@@ -430,7 +430,7 @@ func ImportData(zipPath string) (err error) {return errors.New("check data.zip failed")}if 1 != len(dirs) {- return errors.New("invalid data.zip")+ return errors.New(Conf.Language(198))}tmpDataPath := filepath.Join(unzipPath, dirs[0].Name())