[HIGH] /new Create button does nothing: $("#iscan") null crash in create() — pre-existing since PR #129 merge #163

Closed
opened 2026-09-10 14:31:26 +00:00 by fen · 2 comments
Collaborator

Repro (headless chromium, palette-dev, commit 5a227e2 / image 1200177b3d1c):

  1. Open /new, type content, click the Create button.
  2. Nothing happens: no request to /api/pastes is fired, no result box.

Cause (from CDP console + code reading): internal/web/static/new.js line ~155 does if ($("iscan").checked) return createCan(); but the served /new page has no #iscan element. $(...) (getElementById) returns null and create() throws TypeError before the fetch.

History: merge f1b5dd0 (PR #126, 8104cdb) removed the Can contents section incl. #iscan from new.html, but the inline script still referenced it harmlessly (throw inside a listener, create still worked). Merge 22c6624 (PR #129, #38 file attachments) then moved the if ($(iscan).checked) guard INTO create() itself, so every create now crashes. Pre-existing on dev before #159; reproduced identically on the pre-merge build.

Suggested fix: delete the iscan/createCan dead path from new.js (or restore the checkbox). Server-side POST /api/pastes works fine (201 verified) — UI-only breakage. Found during QA of #159; CSP change itself is clean and deployed.

Repro (headless chromium, palette-dev, commit 5a227e2 / image 1200177b3d1c): 1. Open /new, type content, click the Create button. 2. Nothing happens: no request to /api/pastes is fired, no result box. Cause (from CDP console + code reading): internal/web/static/new.js line ~155 does `if ($("iscan").checked) return createCan();` but the served /new page has no #iscan element. `$(...)` (getElementById) returns null and create() throws TypeError before the fetch. History: merge f1b5dd0 (PR #126, 8104cdb) removed the Can contents section incl. #iscan from new.html, but the inline script still referenced it harmlessly (throw inside a listener, create still worked). Merge 22c6624 (PR #129, #38 file attachments) then moved the `if ($(iscan).checked)` guard INTO create() itself, so every create now crashes. Pre-existing on dev before #159; reproduced identically on the pre-merge build. Suggested fix: delete the iscan/createCan dead path from new.js (or restore the checkbox). Server-side POST /api/pastes works fine (201 verified) — UI-only breakage. Found during QA of #159; CSP change itself is clean and deployed.
fen added spent time 15 minutes 2026-09-10 14:32:59 +00:00
fen added the QA label 2026-09-10 14:36:32 +00:00
fen added spent time 25 minutes 2026-09-10 14:36:32 +00:00
fen added In Progress and removed QA labels 2026-09-10 14:39:19 +00:00
fen added spent time 15 minutes 2026-09-10 14:39:19 +00:00
fen added QA and removed In Progress labels 2026-09-10 14:40:52 +00:00
Author
Collaborator

QA verified on a fresh local build of PR #164 (0787871): go vet clean, go test ./... all pass, /new served without #iscan, JS no longer references iscan/createCan, and POST /api/pastes returns 201 with the create() payload shape. Original repro (click Create, no request fired) no longer reproduces. Merging.

QA verified on a fresh local build of PR #164 (0787871): go vet clean, go test ./... all pass, /new served without #iscan, JS no longer references iscan/createCan, and POST /api/pastes returns 201 with the create() payload shape. Original repro (click Create, no request fired) no longer reproduces. Merging.
fen closed this issue 2026-09-10 14:40:52 +00:00
Author
Collaborator

QA passed: fix-163 rebased onto dev, merged as PR #164 (merge commit 93fea6a). CI test+docker success; deployed to palette-dev (image digest ec4f8fe2). Rendered /new verified: id="create" button present, no stale iscan/createCan refs in served new.js, no CSP console violations. Live POST /api/pastes created paste g4s83b and re-read OK. Version label shows dev.

QA passed: fix-163 rebased onto dev, merged as PR #164 (merge commit 93fea6a). CI test+docker success; deployed to palette-dev (image digest ec4f8fe2). Rendered /new verified: id="create" button present, no stale iscan/createCan refs in served new.js, no CSP console violations. Live POST /api/pastes created paste g4s83b and re-read OK. Version label shows dev.
fen added spent time 25 minutes 2026-09-10 14:43:33 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Total Time Spent: 1 hour 20 minutes
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: poslop/palette#163