Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/5309

Vanessad06ebab62fec
diff --git a/app/src/protyle/export/index.ts b/app/src/protyle/export/index.ts
index 49310bb272..8f0e398f2a 100644
--- a/app/src/protyle/export/index.ts
+++ b/app/src/protyle/export/index.ts
@@ -1,4 +1,4 @@
-import {showMessage} from "../../dialog/message";
+import {hideMessage, showMessage} from "../../dialog/message";
import {Constants} from "../../constants";
/// #if !BROWSER
import {PrintToPDFOptions, OpenDialogReturnValue} from "electron";
@@ -147,15 +147,21 @@ const getExportPath = (option: { type: string, id: string }, pdfOption?: PrintTo
} else if (option.type === "word") {
url = "/api/export/exportDocx";
}
+ const savePath = result.filePaths[0].endsWith(response.data.rootTitle) ? result.filePaths[0] : path.join(result.filePaths[0], response.data.rootTitle);
fetchPost(url, {
id: option.id,
pdf: option.type === "pdf",
- savePath: result.filePaths[0]
+ savePath
}, exportResponse => {
if (option.type === "word") {
- afterExport(result.filePaths[0], msgId);
+ if (exportResponse.code === 1) {
+ hideMessage(msgId);
+ showMessage(exportResponse.msg, undefined, "error");
+ return;
+ }
+ afterExport(savePath, msgId);
} else {
- onExport(exportResponse, result.filePaths[0], option.type, pdfOption, removeAssets, msgId);
+ onExport(exportResponse, savePath, option.type, pdfOption, removeAssets, msgId);
}
});
}