mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-06 10:09:58 +08:00
🐛 Documents exported in the doc tree can no longer be imported Fix https://github.com/siyuan-note/siyuan/issues/11447
This commit is contained in:
parent
491a1696c1
commit
64c4bed8ab
@ -110,15 +110,16 @@ func ImportSY(zipPath, boxID, toPath string) (err error) {
|
|||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
unzipRootPaths, err := filepath.Glob(unzipPath + "/*")
|
entries, err := os.ReadDir(unzipPath)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
|
logging.LogErrorf("read unzip dir [%s] failed: %s", unzipPath, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if 1 != len(unzipRootPaths) {
|
if 1 != len(entries) {
|
||||||
logging.LogErrorf("invalid .sy.zip [%v]", unzipRootPaths)
|
logging.LogErrorf("invalid .sy.zip [%v]", entries)
|
||||||
return errors.New(Conf.Language(199))
|
return errors.New(Conf.Language(199))
|
||||||
}
|
}
|
||||||
unzipRootPath := unzipRootPaths[0]
|
unzipRootPath := filepath.Join(unzipPath, entries[0].Name())
|
||||||
name := filepath.Base(unzipRootPath)
|
name := filepath.Base(unzipRootPath)
|
||||||
if strings.HasPrefix(name, "data-20") && len("data-20230321175442") == len(name) {
|
if strings.HasPrefix(name, "data-20") && len("data-20230321175442") == len(name) {
|
||||||
logging.LogErrorf("invalid .sy.zip [unzipRootPath=%s, baseName=%s]", unzipRootPath, name)
|
logging.LogErrorf("invalid .sy.zip [unzipRootPath=%s, baseName=%s]", unzipRootPath, name)
|
||||||
|
Loading…
Reference in New Issue
Block a user