mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-10 23:59:45 +08:00
fix(BackupManager): add content length to WebDAV file upload options (#6977)
feat(BackupManager): add content length to WebDAV file upload options
This commit is contained in:
parent
3f35ad998c
commit
c6a965028e
@ -295,10 +295,12 @@ class BackupManager {
|
|||||||
async backupToWebdav(_: Electron.IpcMainInvokeEvent, data: string, webdavConfig: WebDavConfig) {
|
async backupToWebdav(_: Electron.IpcMainInvokeEvent, data: string, webdavConfig: WebDavConfig) {
|
||||||
const filename = webdavConfig.fileName || 'cherry-studio.backup.zip'
|
const filename = webdavConfig.fileName || 'cherry-studio.backup.zip'
|
||||||
const backupedFilePath = await this.backup(_, filename, data, undefined, webdavConfig.skipBackupFile)
|
const backupedFilePath = await this.backup(_, filename, data, undefined, webdavConfig.skipBackupFile)
|
||||||
|
const contentLength = (await fs.stat(backupedFilePath)).size
|
||||||
const webdavClient = new WebDav(webdavConfig)
|
const webdavClient = new WebDav(webdavConfig)
|
||||||
try {
|
try {
|
||||||
const result = await webdavClient.putFileContents(filename, fs.createReadStream(backupedFilePath), {
|
const result = await webdavClient.putFileContents(filename, fs.createReadStream(backupedFilePath), {
|
||||||
overwrite: true
|
overwrite: true,
|
||||||
|
contentLength
|
||||||
})
|
})
|
||||||
// 上传成功后删除本地备份文件
|
// 上传成功后删除本地备份文件
|
||||||
await fs.remove(backupedFilePath)
|
await fs.remove(backupedFilePath)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user