Skip to content

Commit ebfc67f

Browse files
PR Batch Testerclaude
andcommitted
fix(server): preview snapshot reports a data: page's URL by type only
preview_snapshot returned location.href as-is, so a tab on a data: page still handed the agent the page's contents through the snapshot URL. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 8a00121 commit ebfc67f

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

‎apps/server/src/preview/ServerBrowserPage.test.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,11 @@ describe("server browser element refs", () => {
215215
expect(tree).not.toContain("PAYLOAD");
216216
});
217217

218+
it("shows a data: page's own URL by media type only", async () => {
219+
await page.goto("data:text/html,<title>Key</title>PAYLOAD");
220+
expect((await takeSnapshot()).url).toBe("data:text/html,…");
221+
});
222+
218223
it("shows data: URLs in Chromium's console messages by media type, and page logs as written", async () => {
219224
const logged: Array<string> = [];
220225
page.on("console", (message) => logged.push(ServerBrowserPage.consoleText(message)));

‎apps/server/src/preview/ServerBrowserPage.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,7 @@ const capture = async (
594594
});
595595
return {
596596
...page,
597+
url: withoutDataPayload(page.url),
597598
// Text that holds a value would otherwise show where the tree masked it. Masked before
598599
// the cut, so a value crossing it can't leave its start showing.
599600
visibleText: mask(page.visibleText).slice(0, MAX_VISIBLE_TEXT_LENGTH),

0 commit comments

Comments
 (0)