mirror of
https://github.com/nesquena/hermes-webui.git
synced 2026-05-14 15:07:45 +00:00
e61a405add
Batch release v0.50.231 — 3 fixes. ## PRs included | PR | Author | Fix | |---|---|---| | #1186 | @nesquena (Claude Code) | macOS `/etc` symlink bypass in workspace blocked-roots | | #1187 | @nesquena-hermes | Workspace panel stuck closed after empty-session reload | | #1190 | @bergeouss | Fenced code content leaking into markdown passes (#1154) | All three PRs were independently reviewed and approved by @nesquena. ## Test results **2729 passed, 2 skipped** (2 macOS-only tests correctly skipped on Linux). Browser QA: **21/21**. ## Key fix notes **#1186:** `_workspace_blocked_roots()` now returns both literal and `Path.resolve()` forms of each blocked root. macOS symlinks (`/etc → /private/etc`) previously let a resolved candidate slip past the literal check. New `_is_blocked_system_path()` helper with `/var/folders` and `/var/tmp` carve-outs for pytest temp dirs. **#1187:** Regression from #1182 — `syncWorkspacePanelState()` force-closed on any no-session state. Now only closes in `'preview'` mode. Both boot paths restore localStorage panel pref before sync. **#1190:** Fenced code blocks are now stashed as `\x00P<n>\x00` tokens through ALL markdown passes (list/heading/table regexes), restored at the very end. Previously, diff hunks and markdown headings inside code blocks triggered those regexes, injecting `<ul>/<li>/<h>` tags that broke `</pre>` closure.
27 lines
994 B
Python
27 lines
994 B
Python
"""Regression tests for fenced code block syntax highlighting."""
|
|
from pathlib import Path
|
|
|
|
UI_JS = Path(__file__).resolve().parent.parent / "static" / "ui.js"
|
|
|
|
|
|
def _read_ui_js() -> str:
|
|
return UI_JS.read_text()
|
|
|
|
|
|
def test_fenced_code_blocks_add_prism_language_class():
|
|
js = _read_ui_js()
|
|
assert 'class="language-${esc(lang)}"' in js, (
|
|
"Fenced code blocks should add Prism language-* classes so syntax highlighting works"
|
|
)
|
|
|
|
def test_fenced_code_blocks_keep_existing_pre_header_layout():
|
|
js = _read_ui_js()
|
|
# The fenced code rendering was moved into the stash callback (#1154 fix).
|
|
# The template string now uses `lang` instead of `normalizedLang`.
|
|
assert '${h}<pre><code${langAttr}>${esc(code.replace(/\\n$/,' in js, (
|
|
"The syntax-highlight fix should preserve the existing fenced code block layout"
|
|
)
|
|
assert '<div class="code-block">' not in js, (
|
|
"This fix should not introduce a new wrapper around fenced code blocks"
|
|
)
|