{"record":{"id":"ca92340ce5f5bcce","repo":"siyuan-note/siyuan","slug":"invalid-table-cell-rich-text-payload","errorCode":null,"errorMessage":"Invalid table cell rich text payload","messagePattern":"Invalid table cell rich text payload","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"app/src/protyle/util/tableCellRichValue.ts","lineNumber":19,"sourceCode":"export const TABLE_CELL_RICH_ATTRIBUTE = \"data-sy-table-cell-rich\";\nexport const TABLE_RICH_ATTRIBUTE = \"custom-sy-table-rich\";\n\nexport interface TableCellRich {\n    spec: 1;\n    format: \"kramdown\";\n    content: string;\n}\n\nexport const encodeTableCellRich = (content: string) => {\n    const bytes = new TextEncoder().encode(JSON.stringify({spec: 1, format: \"kramdown\", content}));\n    let binary = \"\";\n    bytes.forEach(byte => binary += String.fromCharCode(byte));\n    return btoa(binary).replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=+$/, \"\");\n};\n\nexport const decodeTableCellRich = (encoded: string): TableCellRich => {\n    if (!/^[A-Za-z0-9_-]+$/.test(encoded)) {\n        throw new Error(\"Invalid table cell rich text payload\");\n    }\n    const bytes = Uint8Array.from(atob(encoded.replace(/-/g, \"+\").replace(/_/g, \"/\")), char => char.charCodeAt(0));\n    const value = JSON.parse(new TextDecoder(\"utf-8\", {fatal: true}).decode(bytes));\n    if (!value || Object.keys(value).length !== 3 || value.spec !== 1 || value.format !== \"kramdown\" ||\n        typeof value.content !== \"string\" || value.content.includes(\"\\u0000\")) {\n        throw new Error(\"Unsupported table cell rich text format\");\n    }\n    return value;\n};\n","sourceCodeStart":1,"sourceCodeEnd":29,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/app/src/protyle/util/tableCellRichValue.ts#L1-L29","documentation":"Guard in decodeTableCellRich: the encoded attribute string contains characters outside the base64url alphabet, so it is not a validly encoded table-cell rich-text payload — the data-sy-table-cell-rich attribute was corrupted or hand-edited.","triggerScenarios":"Thrown at app/src/protyle/util/tableCellRichValue.ts:19 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Edit the table cell to rewrite its rich text content","Remove the invalid data-sy-table-cell-rich attribute","Restore the document from history"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}