fix(B04): prevent image URI flash across initial render and detail remounts

This commit is contained in:
Codex committed 2026-10-21 15:15:29 +09:00
1 parent 0b613e522d
commit 342820690f
7 files changed
+217 -24

No files matched your search

+15 -1
View File
@@ -103,7 +103,21 @@ function testMarkdownImageServerFallback(): void {
const source = 'C:\\workspace\\source-only.png'
const sourceFallback = renderToStaticMarkup(<MarkdownImage src={source} urlList={[]} />)
assert.ok(sourceFallback.includes(source))
assert.ok(!sourceFallback.includes(source), 'unresolved source is never fallback text')
assert.ok(sourceFallback.length < 500)
const synthetic = 'data:image/png;base64,' + 'A'.repeat(24000)
const first = renderToStaticMarkup(<MarkdownImage src={synthetic} alt="" urlList={[synthetic]} />)
assert.match(first, /<img /)
assert.ok(first.includes(`src="${synthetic}"`))
assert.ok(!first.includes('cr-image-block-fallback'))
assert.ok(!first.replace(/<[^>]*>/g, '').includes('data:image'))
for (const invalid of ['javascript:alert(1)', 'data:text/html,' + 'A'.repeat(24000)]) {
const markup = renderToStaticMarkup(<MarkdownImage src={invalid} alt="" urlList={[]} />)
assert.ok(markup.length < 500)
assert.ok(!markup.includes(invalid))
assert.ok(!markup.includes('<img '))
}
}
function testPreviewDialogServerStructure(): void {