Session viewer static JavaScript contains a syntax error
OpenCodeReview Version
open-code-review dev linux/amd64 https://github.com/alibaba/open-code-review
Operating System
Linux (x86_64)
Installation Method
Built from source
LLM Provider
Other OpenAI-compatible endpoint
Bug Description
The viewer's embedded JavaScript file internal/viewer/static/session.js contains an incomplete regular-expression statement:
html = html.replace(/
As a result, JavaScript syntax validation fails:
SyntaxError: Invalid regular expression: missing /
The issue reproduces on the latest upstream/main commit e33d09e and release v1.8.9.
Because the file cannot be parsed, the browser may not execute the viewer's response-formatting logic. The exact visual impact should be verified separately, but the JavaScript syntax error is directly reproducible with:
node --check internal/viewer/static/session.js
Steps to Reproduce
-
Clone the repository and check out the affected commit:
git clone https://github.com/alibaba/open-code-review.git cd open-code-review git checkout e33d09e -
Run JavaScript syntax validation:
node --check internal/viewer/static/session.js -
Observe the failure:
SyntaxError: Invalid regular expression: missing /
The error points to the incomplete statement near line 12:
html = html.replace(/
Expected Behavior
The file internal/viewer/static/session.js should be valid JavaScript.
Running:
node --check internal/viewer/static/session.js
should complete successfully without reporting a syntax error.
The viewer should then be able to load and execute the session JavaScript normally.
Logs / Error Output
node --check internal/viewer/static/session.js
internal/viewer/static/session.js:12
html = html.replace(/
^
SyntaxError: Invalid regular expression: missing /
Additional Context
No response
Hi, I’d like to work on this issue.
I reproduced the syntax error on the latest main commit (e33d09e) using:
node --check internal/viewer/static/session.js
The issue was introduced in commit d1008b8f3bd39a596e1bf3390ddffe2fe1ecbc49:
feat(viewer): add defense-in-depth security headers (#735)
That change added a strict Content Security Policy and moved the session viewer’s formatting script from an inline
Owner
Other Repo Issues