Watch
0
0
Fork
You've already forked hyperhive
0

swarm-ui: open the terminal, group and flow pages for a malformed address

A name or id that isn't valid percent-encoding (for example /agents/%E0%A4%A/terminal)
made decodeURIComponent throw while the page rendered, leaving a blank page. The
segment now stays as typed, as the agents page already did, so the page opens
(a terminal for that name, disconnected). A tested helper does the decoding.
This commit is contained in:
iris 2026-11-25 19:58:30 +01:00 • committed by mara
commit 79f2d4bd4d

View file

@ -7,6 +7,7 @@ import {
isFullBleedRoute,
movedHref,
pageOf,
safeDecode,
selectedAgent,
visibleNavItems,
} from "../src/shell/routes.ts";
@ -113,3 +114,9 @@ test("an agent selected on the agents page is still the agents page", () => {
assert.equal(pageOf("/agents/group/g1"), "/agents/group/g1");
assert.equal(pageOf("/jobs"), "/jobs");
});
test("a path segment decodes, and a malformed one comes back as typed", () => {
assert.equal(safeDecode("my%20agent"), "my agent");
assert.equal(safeDecode("plain"), "plain");
assert.equal(safeDecode("%E0%A4%A"), "%E0%A4%A");
});