Skip to content

fix: restore compact JS placeholders in session export template#49961

Closed
martenzi wants to merge 2 commits into
openclaw:mainfrom
martenzi:fix-session-export-placeholders
Closed

fix: restore compact JS placeholders in session export template#49961
martenzi wants to merge 2 commits into
openclaw:mainfrom
martenzi:fix-session-export-placeholders

Conversation

@martenzi

Copy link
Copy Markdown

Fixes #49957

The session export template at src/auto-reply/reply/export-html/template.html had its JS placeholders reformatted into multi-line blocks. This prevented the .replace() calls in the export logic from finding and injecting the vendored JS, resulting in empty exports in the browser.

This PR restores the single-line format.

Automated formatters like Prettier can expand the single-line placeholders into multi-line blocks with semicolons. This prevents the literal string replacement in the export code from matching.
@greptile-apps

greptile-apps Bot commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR is a targeted bug fix that restores the single-line {{PLACEHOLDER}} format for JS injection placeholders in src/auto-reply/reply/export-html/template.html, which had been accidentally reformatted into multi-line blocks (e.g., { { MARKED_JS; } }) in a previous commit.

The fix is correct: the injection logic in commands-export-session.ts uses exact-string .replace("{{MARKED_JS}}", ...), .replace("{{HIGHLIGHT_JS}}", ...), and .replace("{{JS}}", ...) calls that require the placeholders to appear as compact single-line tokens. The reformatted multi-line versions would never match, leaving blank <script> blocks and broken exports in the browser.

  • Restores {{MARKED_JS}}, {{HIGHLIGHT_JS}}, and {{JS}} to their expected single-line forms in template.html
  • No logic changes; purely a template formatting correction
  • Matches the expectations of both the production export code (commands-export-session.ts) and the security test suite (template.security.test.ts)

Confidence Score: 5/5

  • This PR is safe to merge — it is a minimal, correct restoration of broken template placeholders with no logic changes.
  • The change is a one-to-one restoration of known-good placeholder strings. The .replace() call sites in commands-export-session.ts and the security test suite both confirm the expected {{PLACEHOLDER}} format. No new behaviour is introduced and no other files are touched.
  • No files require special attention.

Last reviewed commit: "fix(export): restore..."

…r corruption

This prevents Prettier from reformatting {{PLACEHOLDER}} blocks into multi-line scripts, which breaks the string-replacement logic in the export command. Follow-up to PR openclaw#49961.
wzhgba pushed a commit to SenseTime-FVG/openclaw that referenced this pull request Apr 20, 2026
…r corruption

This prevents Prettier from reformatting {{PLACEHOLDER}} blocks into multi-line scripts, which breaks the string-replacement logic in the export command. Follow-up to PR openclaw#49961.
@vincentkoc vincentkoc added the clawsweeper Tracked by ClawSweeper automation label Apr 28, 2026
@vincentkoc

Copy link
Copy Markdown
Member

Thanks for the fix here. This path is now covered by #41861, which landed the canonical export HTML placeholder repair with regression coverage. Closing this PR as superseded so we keep one landed implementation and preserve contributor credit in the cluster record.

@vincentkoc vincentkoc closed this Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper Tracked by ClawSweeper automation size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Session export HTML is empty due to reformatted JS placeholders in template

2 participants