Skip to content

fix: restore export-html template placeholders and prevent reformatting#43634

Closed
iteemoo6 wants to merge 1 commit into
openclaw:mainfrom
iteemoo6:fix-export-html-template
Closed

fix: restore export-html template placeholders and prevent reformatting#43634
iteemoo6 wants to merge 1 commit into
openclaw:mainfrom
iteemoo6:fix-export-html-template

Conversation

@iteemoo6

Copy link
Copy Markdown

This PR fixes the export-html template that was broken by a formatter.

What was broken:

  • The template placeholders , , and were being split into multiple lines by the formatter
  • This caused the export-html functionality to fail because the placeholders couldn't be recognized

What this PR does:

  1. Restores the original template.html with correct placeholder formatting
  2. Adds to to prevent future reformatting
  3. Keeps the existing ignore in as an extra layer of protection

Closes #43616, #43620

- Fix template.html placeholders that were broken by formatter
- Add template.html to .gitattributes to prevent future reformatting
- The {{MARKED_JS}}, {{HIGHLIGHT_JS}}, {{JS}} placeholders were being split into multiple lines
- Also keep {{CSS}} and {{SESSION_DATA}} in their original format

Closes openclaw#43616, openclaw#43620
@greptile-apps

greptile-apps Bot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a regression where a code formatter corrupted the five template placeholders ({{CSS}}, {{SESSION_DATA}}, {{MARKED_JS}}, {{HIGHLIGHT_JS}}, {{JS}}) in template.html by splitting each {{...}} across multiple lines, causing all .replace() substitutions in commands-export-session.ts to silently fail and producing broken HTML exports. The fix restores the placeholders to single-line form and adds a .gitattributes -text marker to prevent Git from normalising the file's line endings in the future.

Key changes:

  • template.html: All five placeholders are now on a single line each — the vendored-library and session-data placeholders are inlined directly inside their <script> tags (<script>{{MARKED_JS}}</script>) so a formatter is less likely to interpret the braces as a JS block statement and reformat them.
  • .gitattributes: template.html is marked -text, consistent with how the two CLAUDE.md files are treated in this repo.

No functional issues found. The placeholder strings exactly match what generateHtml() and the security test's renderTemplate() both look for with their .replace("{{...}}", ...) calls.

Confidence Score: 5/5

  • This PR is safe to merge — it is a straightforward restoration of broken placeholder strings with no logic changes.
  • The change is minimal and targeted: it restores five template placeholders to their correct single-line form and adds a .gitattributes entry. The substitution logic in both commands-export-session.ts and the security test file already expects exactly these single-line placeholder strings, so the fix is consistent with the existing code. No new logic is introduced.
  • No files require special attention.

Last reviewed commit: 7428668

@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Apr 27, 2026
@clawsweeper

clawsweeper Bot commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

Closing this as duplicate or superseded after Codex automated review.

Close this PR as superseded by open PR #41861 and open issue #41862. The export-session HTML bug is real and still present on current main, but this PR is a narrower duplicate fix: it restores template placeholders and adds a .gitattributes marker, while #41861 is the better canonical fix because it also changes JS/vendor asset injection to function replacers to avoid String.replace $-sequence mutation.

Best possible solution:

Close this PR as superseded and keep the remaining work focused on #41861/#41862. The best fix should restore formatter-safe template placeholders, use function replacers for injected JS/vendor assets, add a regression test that reads the real template.html path, and verify the build-copy path ships corrected export assets.

What I checked:

So I’m closing this here and keeping the remaining discussion on the canonical linked item.

Codex Review notes: model gpt-5.5, reasoning high; reviewed against 91e835ebe0ab.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale Marked as stale due to inactivity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

export-html template.html 被格式化工具错误处理导致导出失败

1 participant