Skip to content

fix(ui): decode $ entity in legacy Story Block editor on reopen (#35782)#36408

Merged
dsolistorres merged 1 commit into
mainfrom
issue-35782-legacy-editor-dollar-sign
Jul 2, 2026
Merged

fix(ui): decode $ entity in legacy Story Block editor on reopen (#35782)#36408
dsolistorres merged 1 commit into
mainfrom
issue-35782-legacy-editor-dollar-sign

Conversation

@dsolistorres

@dsolistorres dsolistorres commented Jul 2, 2026

Copy link
Copy Markdown
Member

Proposed Changes

Follow-up to #36346. That PR fixed the backend read boundary so both editors now receive a clean literal $. This PR fixes the remaining failure in the legacy content editor.

Problem

When a Story Block field contains a $, reopening the content in the legacy content editor showed $50 instead of $50 (and could re-persist $ on save). The new editor was already correct after #36346.

Root cause

edit_field.jsp re-encodes $$ and backtick → ` server-side (line ~220) so the value can be embedded safely inside a JS template literal ($ guards against ${...} interpolation, backtick against early string termination — StringEscapeUtils.escapeJavaScript does not cover either).

The only code that reversed that encoding lived inside the JSON.parse catch (the markdown fallback). A real Block Editor value is valid JSON, so JSON.parse succeeds, the catch never runs, and $ flowed straight into ProseMirror — and could be re-persisted via the JSON.stringify(content) assignment below.

Fix

Decode the template-literal-safety encoding once, before the try, so both the JSON (Block Editor) and markdown-fallback paths receive a clean value. The now-redundant .replace(...) inside the catch is removed.

This does not weaken the server-side escaping: the .replace() runs on the already-parsed runtime string, changing data content only — never code structure — so template-literal injection remains neutralized.

Checklist

How to test

  1. Content Type with a Story Block field, rendered via the legacy content editor
  2. Enter The application fee is $50., save + publish
  3. Reopen in the legacy editor → shows $50, not $50

Refs: #35782

🤖 Generated with Claude Code

This PR fixes: #35782

The legacy content editor re-encoded `$` to `$` (and backtick to
```) so the value could be safely embedded inside a JS template
literal, but only decoded it inside the JSON.parse catch block. Valid
Block Editor JSON parses successfully, so the catch never ran and
`$` leaked into ProseMirror (and could be re-persisted via
JSON.stringify). Decode now happens once, before the try, on both the
JSON and markdown-fallback paths.

Refs: #35782

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@claude

claude Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Claude finished @dsolistorres's task in 3m 7s —— View job


I'll analyze this and get back to you.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

🤖 dotBot Review (Bedrock)

Reviewed 1 file(s); 1 candidate(s) → 0 confirmed, 0 uncertain (unverified, kept for review).

✅ No issues found after verification.


us.deepseek.r1-v1:0 · Run: #28618371233 · tokens: in: 6498 · out: 2508 · total: 9006 · calls: 3 · est. ~$0.022

@dsolistorres dsolistorres enabled auto-merge July 2, 2026 20:18
@dsolistorres dsolistorres added this pull request to the merge queue Jul 2, 2026
@mergify

mergify Bot commented Jul 2, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

Merged via the queue into main with commit 9e59064 Jul 2, 2026
62 checks passed
@dsolistorres dsolistorres deleted the issue-35782-legacy-editor-dollar-sign branch July 2, 2026 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area : Backend PR changes Java/Maven backend code

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Block Editor: Dollar sign ($) replaced with HTML entity &#36; after save/publish

2 participants