ea6c49f046
支持全部页面分页/多选/删除/分享,删除时可选移除广场帖并清理工作区附件;修复并发同步重复创建页面,并补齐预览下载链接重写与 iframe 下载权限。 Co-authored-by: Cursor <cursoragent@cursor.com>
24 lines
1.1 KiB
JavaScript
24 lines
1.1 KiB
JavaScript
import assert from 'node:assert/strict';
|
|
import test from 'node:test';
|
|
import { pagePurgeInternals } from './mindspace-page-purge.mjs';
|
|
|
|
const { extractAssetIdsFromHtml, collectWorkspacePurgeTargets } = pagePurgeInternals;
|
|
|
|
test('extractAssetIdsFromHtml collects mindspace asset download urls', () => {
|
|
const html =
|
|
'<img src="/api/mindspace/v1/assets/asset-a/download?inline=1">' +
|
|
'<a href="https://example.com/api/mindspace/v1/assets/asset-b/download">link</a>';
|
|
assert.deepEqual(extractAssetIdsFromHtml(html).sort(), ['asset-a', 'asset-b']);
|
|
});
|
|
|
|
test('collectWorkspacePurgeTargets includes html, thumbnails, and sibling downloads', () => {
|
|
const html = [
|
|
'<a href="半导体行业趋势分析报告.docx" download>下载</a>',
|
|
'<img src="/api/mindspace/v1/assets/asset-a/download?inline=1">',
|
|
].join('');
|
|
const targets = collectWorkspacePurgeTargets('public/report.html', html);
|
|
assert.ok(targets.includes('public/report.html'));
|
|
assert.ok(targets.includes('public/report.thumbnail.svg'));
|
|
assert.ok(targets.includes('public/半导体行业趋势分析报告.docx'));
|
|
});
|