From e7721827245501ea2090610de6a42f8d54a7d866 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?m=C3=BCde?= Date: Sun, 17 May 2026 23:25:51 +0200 Subject: [PATCH] path linkify: skip trailing-slash (directory) matches --- hive-c0re/assets/app.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hive-c0re/assets/app.js b/hive-c0re/assets/app.js index a2206eb..18f9c4d 100644 --- a/hive-c0re/assets/app.js +++ b/hive-c0re/assets/app.js @@ -48,7 +48,13 @@ // perspective (we'd need to know which agent the message is about // to translate it). Prefer `/agents//state/...` in agent // outputs and the link will resolve. - const PATH_RE = /(\/var\/lib\/hyperhive\/agents\/[\w.-]+\/state\/[\w./-]+|\/var\/lib\/hyperhive\/shared\/[\w./-]+|\/agents\/[\w.-]+\/state\/[\w./-]+|\/shared\/[\w./-]+)/g; + // Each branch insists the tail is at least one segment AND the + // last character is `[\w.-]` (not `/`), so trailing-slash paths + // — i.e. plain directories — don't linkify. The /api/state-file + // endpoint also refuses non-files; this is the front-end peer so + // the operator doesn't see a dead link they'll just get an error + // from on click. + const PATH_RE = /(\/var\/lib\/hyperhive\/agents\/[\w.-]+\/state\/(?:[\w.-]+\/)*[\w.-]+|\/var\/lib\/hyperhive\/shared\/(?:[\w.-]+\/)*[\w.-]+|\/agents\/[\w.-]+\/state\/(?:[\w.-]+\/)*[\w.-]+|\/shared\/(?:[\w.-]+\/)*[\w.-]+)/g; async function fetchStateFile(path) { const resp = await fetch('/api/state-file?path=' + encodeURIComponent(path)); const text = await resp.text();