mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-10-13 04:59:51 +08:00
fix(mcp-server): fix duplicate page exports and auto-save deleting user files
- Preview page: keep an MCP export open until the server has its result. A poll answered before that still saw the request and started the same export again, so a parallel page export could write the previous page's image into its file - Auto-save only removes its own mcp-*.drawio files, so a DRAWIO_DATA_DIR that also holds the user's diagrams keeps them - screenshot_diagram captures a page that has no id attribute by loading just that page, like export_diagram - An empty <Array as="points"/> no longer hides orphan mxPoints that come after it - POST /api/state refuses a push without xml, which used to wipe the stored diagram - Clear exportOptions when an export ends, reuse hasCells for the empty diagram check, and reword two log lines
This commit is contained in:
@@ -477,6 +477,11 @@ function handleStateApi(
|
||||
return
|
||||
}
|
||||
|
||||
if (typeof data.xml !== "string") {
|
||||
res.writeHead(400, { "Content-Type": "application/json" })
|
||||
res.end(JSON.stringify({ error: "xml must be a string" }))
|
||||
return
|
||||
}
|
||||
const version = setState(sessionId, data.xml, data.svg, true)
|
||||
res.writeHead(200, { "Content-Type": "application/json" })
|
||||
res.end(JSON.stringify({ success: true, version }))
|
||||
|
||||
Reference in New Issue
Block a user