🎨 改进导入 data.zip 和 .sy.zip 校验失败时的提示 Fix https://github.com/siyuan-note/siyuan/issues/7738

This commit is contained in:
Liang Ding 2023-03-21 18:19:27 +08:00
parent 37e88627c0
commit 3130eaa033
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
6 changed files with 18 additions and 8 deletions

View file

@ -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())