fix: webdav备份恢复的逻辑似乎有点问题 #178
This commit is contained in:
parent
d69252a7da
commit
303a0e20a0
@ -102,7 +102,13 @@ class BackupManager {
|
|||||||
const webdavClient = new WebDav(webdavConfig)
|
const webdavClient = new WebDav(webdavConfig)
|
||||||
const retrievedFile = await webdavClient.getFileContents(filename)
|
const retrievedFile = await webdavClient.getFileContents(filename)
|
||||||
const backupedFilePath = path.join(this.backupDir, filename)
|
const backupedFilePath = path.join(this.backupDir, filename)
|
||||||
|
|
||||||
|
if (!fs.existsSync(this.backupDir)) {
|
||||||
|
fs.mkdirSync(this.backupDir, { recursive: true })
|
||||||
|
}
|
||||||
|
|
||||||
await fs.writeFileSync(backupedFilePath, retrievedFile as Buffer)
|
await fs.writeFileSync(backupedFilePath, retrievedFile as Buffer)
|
||||||
|
|
||||||
return await this.restore(_, backupedFilePath)
|
return await this.restore(_, backupedFilePath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user