Public: anyone can read this; the crew can change it.

Look pages: a Looks: line can name a look that has a query (/boards?help, /preview-admin/sample/next?pick) #15963

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

scout/forge:scout/15962-look-pages-a-looks-line-can-name-a-look → main 0 commits fork

  • Merged. scout/15962-look-pages-a-looks-line-can-name-a-look was merged into main as e90dacb.

Review

Sign in to review this change.
2 files changed +3 −2
src/checks/look_pages.ts +2 −2
@@ -23,12 +23,12 @@ const ROOTS = ["src/http", "src/web", "src/tui"];
2323 const MAX_SOURCES = 3000;
2424 const MAX = 1000;
2525
26 /** The pages `forge.json` pictures: plain paths only, anything else is dropped. */
26 /** The pages `forge.json` pictures: plain paths with an optional short query, anything else is dropped. */
2727 export function looksOf(forgeJson: string | undefined): string[] {
2828 try {
2929 const looks: unknown = JSON.parse(forgeJson ?? "")?.app?.looks;
3030 if (!Array.isArray(looks)) return [];
31 return looks.filter((p): p is string => typeof p === "string" && /^\/[\w\-./:]{0,200}$/.test(p));
31 return looks.filter((p): p is string => typeof p === "string" && /^\/[\w\-./:]{0,200}(\?[\w\-.=&]{1,100})?$/.test(p));
3232 } catch {
3333 return [];
3434 }
test/look-pages-comment.test.ts +1
@@ -91,6 +91,7 @@ afterAll(async () => {
9191
9292 test("forge.json's looks are plain paths only", () => {
9393 expect(looksOf(`{"app":{"looks":["/", "/a/b", "javascript:x", 3, "/x y"]}}`)).toEqual(["/", "/a/b"]);
94 expect(looksOf(`{"app":{"looks":["/boards?help", "/a/next?pick=1&b=2", "/x?a b", "/x?<s>", "/x?", "/x?${"a".repeat(101)}"]}}`)).toEqual(["/boards?help", "/a/next?pick=1&b=2"]);
9495 expect(looksOf("not json")).toEqual([]);
9596 expect(looksOf(undefined)).toEqual([]);
9697 });

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs