Fix #171 (r2): CSP-safe image preview via data: URL #185

Closed
fen wants to merge 0 commits from fix-171-r2 into dev
Collaborator

Replaces URL.createObjectURL (blob:) with FileReader.readAsDataURL (data:) in internal/web/static/new.js so the image preview passes img-src 'self' data: CSP. CSP unchanged.

Verified locally (go build/test pass; headless chromium against local build): image preview loads via data: URL with img.complete=true and zero CSP violations; text upload fills editor; title auto-fills only when blank (typed title never overwritten).

Replaces URL.createObjectURL (blob:) with FileReader.readAsDataURL (data:) in internal/web/static/new.js so the image preview passes img-src 'self' data: CSP. CSP unchanged. Verified locally (go build/test pass; headless chromium against local build): image preview loads via data: URL with img.complete=true and zero CSP violations; text upload fills editor; title auto-fills only when blank (typed title never overwritten).
fen added 1 commit 2026-09-10 16:37:56 +00:00
Fix #171 (r2): file image preview uses data: URL (FileReader) instead of blob: for CSP compliance
CI / docker (pull_request) Skipped
CI / test (pull_request) Successful in 41s
bb7251bd25
fen closed this pull request 2026-09-10 16:39:48 +00:00
fen deleted branch fix-171-r2 2026-09-10 16:39:48 +00:00
fen reopened this pull request 2026-09-10 16:42:18 +00:00
fen added the QA label 2026-09-10 16:50:37 +00:00
fen closed this pull request 2026-09-10 16:53:23 +00:00
Author
Collaborator

QA note: this PR (r2, bb7251b) is superseded and will not be merged. The same fix is already contained in dev (commit 9621faa0 'Merge fix-171-r2 into dev'), PR #186 carried the equivalent FileReader data:-URL change and was merged (368620e) with a QA pass recorded on issue #171, which is closed. Verified on the live dev build (bb72e09) during the #184 QA pass: image preview renders via data: URL on /new with zero CSP violations. Closing as superseded.

QA note: this PR (r2, bb7251b) is superseded and will not be merged. The same fix is already contained in dev (commit 9621faa0 'Merge fix-171-r2 into dev'), PR #186 carried the equivalent FileReader data:-URL change and was merged (368620e) with a QA pass recorded on issue #171, which is closed. Verified on the live dev build (bb72e09) during the #184 QA pass: image preview renders via data: URL on /new with zero CSP violations. Closing as superseded.
fen added spent time 20 minutes 2026-09-10 17:12:19 +00:00
Author
Collaborator

QA PASS (rendered verification on palette-dev, headless chromium against https://palette-dev.archfox.org/new after deploy of merge commit 9621faa, CI test+docker both success):\n- Image preview: #file-preview renders with data:image/png;base64,... src, img.complete=true, naturalWidth/Height=2, .editor-wrap previewing class applied.\n- CSP violations in console/log: 0. Served CSP header unchanged: img-src 'self' data:.\n- Text file upload fills editor content.\n- Title auto-fill: typed title preserved on subsequent attach; blank title autofilled from filename.\n- Merge: PR had a conflict with dev (r1 #186 touched the same block); merged locally --no-ff into dev (9621faa), taking dev's new.js for the conflict (functionally equivalent, already data:-URL, revokeObjectURL cleanup retained). CI green on merge commit.\n- Deployed to palette-dev (rollout complete, image git.archfox.org/poslop/palette:dev current). Issue closed, branch fix-171-r2 deleted.

QA PASS (rendered verification on palette-dev, headless chromium against https://palette-dev.archfox.org/new after deploy of merge commit 9621faa, CI test+docker both success):\n- Image preview: #file-preview renders with data:image/png;base64,... src, img.complete=true, naturalWidth/Height=2, .editor-wrap previewing class applied.\n- CSP violations in console/log: 0. Served CSP header unchanged: img-src 'self' data:.\n- Text file upload fills editor content.\n- Title auto-fill: typed title preserved on subsequent attach; blank title autofilled from filename.\n- Merge: PR had a conflict with dev (r1 #186 touched the same block); merged locally --no-ff into dev (9621faa), taking dev's new.js for the conflict (functionally equivalent, already data:-URL, revokeObjectURL cleanup retained). CI green on merge commit.\n- Deployed to palette-dev (rollout complete, image git.archfox.org/poslop/palette:dev current). Issue closed, branch fix-171-r2 deleted.

Pull request closed

This pull request cannot be reopened because the branch was deleted.
Sign in to join this conversation.