fix: require docx generation for downloadable pages
This commit is contained in:
@@ -66,13 +66,20 @@ test('publish dir and public url use stable user id', () => {
|
||||
publicBaseUrl: 'https://m.tkmind.cn',
|
||||
});
|
||||
const skillPath = path.join(layout.publishDir, '.agents', 'skills', 'static-page-publish', 'SKILL.md');
|
||||
const docxSkillPath = path.join(layout.publishDir, '.agents', 'skills', 'docx-generate', 'SKILL.md');
|
||||
const docxScriptPath = path.join(layout.publishDir, '.agents', 'skills', 'docx-generate', 'generate_docx.py');
|
||||
assert.ok(fs.existsSync(skillPath));
|
||||
assert.ok(fs.existsSync(docxSkillPath));
|
||||
assert.ok(fs.existsSync(docxScriptPath));
|
||||
const skillText = fs.readFileSync(skillPath, 'utf8');
|
||||
const docxSkillText = fs.readFileSync(docxSkillPath, 'utf8');
|
||||
assert.match(skillText, new RegExp(`m\\.tkmind\\.cn/${PUBLISH_ROOT_DIR}/${USER_ID}/${PUBLIC_ZONE_DIR}/`));
|
||||
assert.match(skillText, /public\/report\.html/);
|
||||
assert.match(skillText, /\[.*\]\(.*\)/);
|
||||
assert.match(skillText, /mindspace-cover/);
|
||||
assert.match(skillText, /\.thumbnail\.svg/);
|
||||
assert.match(skillText, /docx-generate/);
|
||||
assert.match(docxSkillText, /public\/文件名\.docx/);
|
||||
});
|
||||
|
||||
test('migrateUserPublishDir merges legacy username directory', () => {
|
||||
@@ -103,6 +110,8 @@ test('buildPublishConstraints scopes default search to user workspace', () => {
|
||||
assert.doesNotMatch(constraints, /对用户统一称 \*\*TKMind\*\*/);
|
||||
assert.match(constraints, /禁止用公网 URL 列目录/);
|
||||
assert.match(constraints, /public\/页面\.html/);
|
||||
assert.match(constraints, /docx-generate/);
|
||||
assert.match(constraints, /public\/\*\.docx/);
|
||||
assert.match(constraints, /\/public\//);
|
||||
});
|
||||
|
||||
@@ -115,6 +124,8 @@ test('buildSandboxSessionConstraints documents shell and forbids public url brow
|
||||
assert.match(text, /禁止.*curl/);
|
||||
assert.match(text, /list_dir 可用/);
|
||||
assert.match(text, /public\/xxx\.html/);
|
||||
assert.match(text, /docx-generate/);
|
||||
assert.match(text, /public\/\*\.docx/);
|
||||
assert.match(text, /\/public\//);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user