diff --git a/CHANGELOG.md b/CHANGELOG.md index 8443093..8fcd0a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Unreleased + +- **One unusual letter no longer blanks the map:** to list the page's own scripts in its Content-Security-Policy, the build reads a lower-cased copy of the page, and a few letters get longer when lower-cased (the Turkish "İ" becomes two characters). One of them anywhere before the scripts, in a comment the scan picked up, a file name or a description, moved every later script by one character in that copy, so their fingerprints were wrong, the browser blocked them and the map drew nothing. Only A to Z are lower-cased now, the way the browser reads tag names, so the copy always lines up with the page. + ## 0.7.3 (2026-11-10) - **A long description no longer covers the map in a short window:** when the map opened in a window that isn’t very tall (a laptop screen, or the map inside a frame), the heading’s description could run over the top row of boxes, because only part of the heading was kept clear when the map was fitted. The whole heading is now kept clear (up to just under half the window), and in a window under 760 pixels tall a long description folds to three lines with a More / Less toggle, as it already did on phones. diff --git a/skills/floorplan/assets/page-safety.mjs b/skills/floorplan/assets/page-safety.mjs index b4eb029..e906a37 100644 --- a/skills/floorplan/assets/page-safety.mjs +++ b/skills/floorplan/assets/page-safety.mjs @@ -35,7 +35,9 @@ const isEnd = (c) => c === undefined || /[\t\n\f\r />]/.test(c); * Returns [{ start, open, end, body, attrs }]: `body` is the text between the tags. */ export function scriptBlocks(html) { - const lower = html.toLowerCase(); + // Only A-Z, as the browser matches tag names: a full toLowerCase() makes some letters longer (the Turkish "İ" + // becomes "i" plus a combining dot), which would shift every index below against `html`. + const lower = html.replace(/[A-Z]/g, (c) => c.toLowerCase()); const out = []; let i = 0; while (i < lower.length) { diff --git a/tests/hostile-content.test.mjs b/tests/hostile-content.test.mjs index e946aa0..55efc59 100644 --- a/tests/hostile-content.test.mjs +++ b/tests/hostile-content.test.mjs @@ -326,6 +326,16 @@ describe('Content-Security-Policy', () => { const page = withPolicy('
\n\n', 'export'); assert.equal(withPolicy(page, 'export'), page, 'adding the policy again replaces it'); }); + + test('a letter that grows when lower-cased (the Turkish "İ") can\'t shift the scripts or their hashes', async () => { + const { scriptBlocks, withPolicy } = await pageSafety(); + const I = String.fromCharCode(0x130); // its toLowerCase() is two characters: "i" and a combining dot + const bodies = [`var a = "${I}${I}";`, 'var b = 2;', 'var c = 3;']; + const html = `\n\n