fix(download): 下载设置抽屉打开时路径显示为空

get-store-value 主进程用 ipcMain.on 同步返回,renderer 却用 invoke 读取会直接
reject,导致 initDownloadSettings 中断、已保存的下载路径等配置回读失败。改为
sendSync,与项目其它调用点保持一致。

contentLength 类型错误非本次提交引入,因无法通过 precommit 检查,故一并修复。
This commit is contained in:
chengww
2026-04-26 21:05:59 +08:00
parent 97220761cf
commit a62f525840
2 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -523,7 +523,7 @@ class DownloadManager {
} else {
// Full response (200) - start from beginning
task.loaded = 0;
const contentLength = response.headers['content-length'];
const contentLength = response.headers['content-length'] as string;
task.total = contentLength ? parseInt(contentLength, 10) : 0;
}
+4 -4
View File
@@ -915,16 +915,16 @@ const saveDownloadSettings = () => {
};
const initDownloadSettings = async () => {
const path = await window.electron.ipcRenderer.invoke('get-store-value', 'set.downloadPath');
const nameFormat = await window.electron.ipcRenderer.invoke(
const path = window.electron.ipcRenderer.sendSync('get-store-value', 'set.downloadPath');
const nameFormat = window.electron.ipcRenderer.sendSync(
'get-store-value',
'set.downloadNameFormat'
);
const separator = await window.electron.ipcRenderer.invoke(
const separator = window.electron.ipcRenderer.sendSync(
'get-store-value',
'set.downloadSeparator'
);
const saveLyric = await window.electron.ipcRenderer.invoke(
const saveLyric = window.electron.ipcRenderer.sendSync(
'get-store-value',
'set.downloadSaveLyric'
);