mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-10-08 18:57:47 +08:00
The fallback condition for PNG detection in the MCP export handler was too broad: it would match any string longer than 100 chars that didn't start with '<', which includes SVG data URLs (data:image/svg+xml;base64,...). This caused a race condition where an autosave SVG export response could arrive while a PNG export was pending, resulting in SVG data being sent to the MCP server as the PNG export result. The server would then try to write it as binary PNG, producing a corrupt file (broken image). Fix: exclude strings starting with 'data:' from the fallback condition, so only raw base64 strings (without a data URL prefix) match as PNG, while SVG data URLs are correctly rejected.