From 64c4bed8ab934bcc59792006f07ee0be3b79607b Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sat, 18 May 2024 00:20:34 +0800 Subject: [PATCH] :bug: Documents exported in the doc tree can no longer be imported Fix https://github.com/siyuan-note/siyuan/issues/11447 --- kernel/model/import.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/kernel/model/import.go b/kernel/model/import.go index 409f1fb1c..d97d189c7 100644 --- a/kernel/model/import.go +++ b/kernel/model/import.go @@ -110,15 +110,16 @@ func ImportSY(zipPath, boxID, toPath string) (err error) { return nil }) - unzipRootPaths, err := filepath.Glob(unzipPath + "/*") + entries, err := os.ReadDir(unzipPath) if nil != err { + logging.LogErrorf("read unzip dir [%s] failed: %s", unzipPath, err) return } - if 1 != len(unzipRootPaths) { - logging.LogErrorf("invalid .sy.zip [%v]", unzipRootPaths) + if 1 != len(entries) { + logging.LogErrorf("invalid .sy.zip [%v]", entries) return errors.New(Conf.Language(199)) } - unzipRootPath := unzipRootPaths[0] + unzipRootPath := filepath.Join(unzipPath, entries[0].Name()) name := filepath.Base(unzipRootPath) if strings.HasPrefix(name, "data-20") && len("data-20230321175442") == len(name) { logging.LogErrorf("invalid .sy.zip [unzipRootPath=%s, baseName=%s]", unzipRootPath, name)