fix: restore public page share thumbnails from SVG sidecars
Serve missing *.thumbnail.png requests when the SVG sidecar exists, and schedule async PNG rasterization after public HTML is materialized so WeChat og:image URLs stop 404ing. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -27,3 +27,16 @@ test('ensureWorkspaceHtmlThumbnail writes sidecar on html save', async () => {
|
||||
assert.match(svg, /运动|普拉提618/i);
|
||||
await fs.access(path.join(root, 'pilates.thumbnail.svg'));
|
||||
});
|
||||
|
||||
test('ensureWorkspaceHtmlThumbnail schedules raster png sidecar', async () => {
|
||||
const root = await fs.mkdtemp(path.join(os.tmpdir(), 'workspace-thumb-png-'));
|
||||
const html = `<!doctype html><html><head>
|
||||
<title>PNG sidecar</title>
|
||||
<meta name="mindspace-cover" content='{"tag":"测试","accent":"#eeb04e","accent2":"#1a0a2e","subtitle":"副标题"}' />
|
||||
</head><body></body></html>`;
|
||||
await fs.writeFile(path.join(root, 'demo.html'), html, 'utf8');
|
||||
await ensureWorkspaceHtmlThumbnail(root, 'demo.html', html, { title: 'PNG sidecar' });
|
||||
await new Promise((resolve) => queueMicrotask(resolve));
|
||||
await new Promise((resolve) => setImmediate(resolve));
|
||||
await fs.access(path.join(root, 'demo.thumbnail.png'));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user