diff --git a/electron/main/fileReader.ts b/electron/main/fileReader.ts
index f7da94564..07201cdc8 100644
--- a/electron/main/fileReader.ts
+++ b/electron/main/fileReader.ts
@@ -380,7 +380,9 @@ export class FileReader {
});
fileStream.on('error', (err) => {
- fs.unlink(localPath, () => { }); // delete incomplete file
+ fs.unlink(localPath, (unlinkErr) => {
+ if (unlinkErr) console.error('Failed to delete incomplete file:', unlinkErr);
+ }); // delete incomplete file
reject(err);
});
});
diff --git a/electron/main/index.ts b/electron/main/index.ts
index 870f314e6..c3b7de4f3 100644
--- a/electron/main/index.ts
+++ b/electron/main/index.ts
@@ -644,7 +644,8 @@ function registerIpcHandlers() {
ipcMain.handle("reveal-in-folder", async (event, filePath: string) => {
try {
- if (filePath.endsWith('/')) {
+ const stats = await fs.promises.stat(filePath.replace(/\/$/, '')).catch(() => null);
+ if (stats && stats.isDirectory()) {
shell.openPath(filePath);
} else {
shell.showItemInFolder(filePath);
diff --git a/src/pages/Setting/Privacy.tsx b/src/pages/Setting/Privacy.tsx
index af8a78127..945995718 100644
--- a/src/pages/Setting/Privacy.tsx
+++ b/src/pages/Setting/Privacy.tsx
@@ -109,7 +109,9 @@ export default function SettingPrivacy() {
}, [email]);
const handleOpenFolder = () => {
- window.ipcRenderer.invoke("reveal-in-folder", logFolder + "/");
+ if (logFolder) {
+ window.ipcRenderer.invoke("reveal-in-folder", logFolder + "/");
+ }
};
return (
@@ -172,7 +174,7 @@ export default function SettingPrivacy() {
-