Compare commits

...

1 commit
main ... v0.2.2

Author SHA1 Message Date
3b5df206ca v0.2.2: escape log line text before feeding to Rich markup
Synology logs often embed bracketed paths like
`[/var/packages/SynoFinder/etc/etc-volume/collect.data]`. Rich
interprets the leading `[/` as a closing tag, so RichLog crashed
with MarkupError the first time the Logs tab was resized and the
deferred-render queue was flushed.

Wrap line.raw in rich.markup.escape() so brackets render as text.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-13 20:09:09 +02:00
3 changed files with 7 additions and 3 deletions

View file

@ -1 +1 @@
__version__ = "0.2.1" __version__ = "0.2.2"

View file

@ -3,6 +3,7 @@ from __future__ import annotations
from collections import deque from collections import deque
from typing import Deque from typing import Deque
from rich.markup import escape
from textual.app import ComposeResult from textual.app import ComposeResult
from textual.containers import Container from textual.containers import Container
from textual.widgets import RichLog, Static from textual.widgets import RichLog, Static
@ -66,8 +67,11 @@ class LogsTab(Container):
Severity.OTHER: theme.BORDER_TITLE, Severity.OTHER: theme.BORDER_TITLE,
} }
color = color_for[line.severity] color = color_for[line.severity]
# Raw log lines often contain literal brackets like
# `[/path/to/file]` which Rich's markup parser tries to interpret
# as closing tags. Escape so they render as text.
src = f"[dim]{line.source:<8}[/]" src = f"[dim]{line.source:<8}[/]"
return f"{src} [{color}]{line.raw}[/]" return f"{src} [{color}]{escape(line.raw)}[/]"
def _rerender(self) -> None: def _rerender(self) -> None:
self.log_view.clear() self.log_view.clear()

View file

@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project] [project]
name = "dsmview" name = "dsmview"
version = "0.2.1" version = "0.2.2"
description = "TUI SSH monitor for Synology DSM 7.x" description = "TUI SSH monitor for Synology DSM 7.x"
readme = "README.md" readme = "README.md"
license = { text = "MIT" } license = { text = "MIT" }