fix: webdav备份恢复的逻辑似乎有点问题 #178

This commit is contained in:
kangfenmao 2024-10-15 17:48:48 +08:00
parent d69252a7da
commit 303a0e20a0

View File

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