Fully autonomous AI Agents system capable of performing complex penetration testing tasks
Go ai-agentsai-security-toolanthropicautonomous-agentsgolanggptgraphqlmulti-agent-systemoffensive-securityopen-sourceopenaipenetration-testingpenetration-testing-toolsreactsecurity-automationsecurity-testingsecurity-toolsself-hosted
fix(markdown-editor): drop the U+001F cell-join byte from saved table markdown
Sergey Kozyrenkoc87a31f38b45
diff --git a/frontend/src/components/shared/markdown-editor/markdown-editor-extensions.test.ts b/frontend/src/components/shared/markdown-editor/markdown-editor-extensions.test.tsindex 13dd0d33..7f504f47 100644--- a/frontend/src/components/shared/markdown-editor/markdown-editor-extensions.test.ts+++ b/frontend/src/components/shared/markdown-editor/markdown-editor-extensions.test.ts@@ -358,3 +358,37 @@ describe('typing matches load — underscore emphasis literal, bare URL autolinkexpect(typeString('a ~~del~~ b').html).toContain('<s>');});});++describe('multi-paragraph table cell does not persist a raw control byte on save', () => {+ const header = (text: string) => ({+ content: [{ content: [{ text, type: 'text' }], type: 'paragraph' }],+ type: 'tableHeader',+ });+ const cell = (...paragraphs: string[]) => ({+ content: paragraphs.map((text) => ({ content: [{ text, type: 'text' }], type: 'paragraph' })),+ type: 'tableCell',+ });++ it('collapses two cell paragraphs to a space instead of joining with U+001F', () => {+ const doc = {+ content: [+ {+ content: [+ { content: [header('h'), header('i')], type: 'tableRow' },+ { content: [cell('one', 'two'), cell('z')], type: 'tableRow' },+ ],+ type: 'table',+ },+ ],+ type: 'doc',+ };+ const editor = new Editor({ content: doc, extensions: createMarkdownExtensions() });+ const md = editor.getMarkdown();++ editor.destroy();++ expect(md).not.toContain('\u001f');+ expect(md).toContain('one two');+ expect(md).toContain('z');+ });+});diff --git a/frontend/src/components/shared/markdown-editor/markdown-editor-marked.ts b/frontend/src/components/shared/markdown-editor/markdown-editor-marked.tsindex e15a4acc..3d918726 100644--- a/frontend/src/components/shared/markdown-editor/markdown-editor-marked.ts+++ b/frontend/src/components/shared/markdown-editor/markdown-editor-marked.ts@@ -94,7 +94,10 @@ export const TunedTable = Table.extend({renderChildren: (nodes, separator) => helpers.renderChildren(nodes, separator).replace(/\|/g, '\\|'),};- return renderTableToMarkdown(node, pipeEscaping);+ // renderTableToMarkdown joins a multi-block cell's children (e.g. two paragraphs from Enter-in-cell) with+ // a U+001F separator, outside renderChildren. A GFM cell is single-line, so collapse it to a space rather+ // than persist a raw control byte that survives into the saved .tmpl/knowledge and round-trips unchanged.+ return renderTableToMarkdown(node, pipeEscaping).replaceAll(String.fromCharCode(0x1f), ' ');},});