🚑 修复导入 Data 路径问题
This commit is contained in:
parent
c3c4061bd4
commit
6e02c3e930
1 changed files with 9 additions and 1 deletions
|
@ -311,12 +311,20 @@ func ImportData(zipPath string) (err error) {
|
|||
if 0 < len(files) {
|
||||
return errors.New("invalid data.zip")
|
||||
}
|
||||
dirs, err := os.ReadDir(unzipPath)
|
||||
if nil != err {
|
||||
util.LogErrorf("check data.zip failed: %s", err)
|
||||
return errors.New("check data.zip failed")
|
||||
}
|
||||
if 1 != len(dirs) {
|
||||
return errors.New("invalid data.zip")
|
||||
}
|
||||
|
||||
writingDataLock.Lock()
|
||||
defer writingDataLock.Unlock()
|
||||
|
||||
filelock.ReleaseAllFileLocks()
|
||||
tmpDataPath := unzipPath
|
||||
tmpDataPath := filepath.Join(unzipPath, dirs[0].Name())
|
||||
if err = stableCopy(tmpDataPath, util.DataDir); nil != err {
|
||||
util.LogErrorf("copy data dir from [%s] to [%s] failed: %s", tmpDataPath, util.DataDir, err)
|
||||
err = errors.New("copy data failed")
|
||||
|
|
Loading…
Add table
Reference in a new issue