Fix session-count script rendered as visible text
_GET_SESSION_COUNT_SCRIPT was a mark_safe string used as a child of the view_game content tree. Under the "only Safe nodes render unescaped" rule, a mark_safe *string* child is escaped — so the <script> showed as literal text on the page. Make it a Safe node (and drop the now-unused mark_safe import). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+2
-2
@@ -8,7 +8,7 @@ from django.middleware.csrf import get_token
|
||||
from django.shortcuts import get_object_or_404, redirect
|
||||
from django.template.defaultfilters import date as date_filter
|
||||
from django.urls import reverse
|
||||
from django.utils.safestring import SafeText, mark_safe
|
||||
from django.utils.safestring import SafeText
|
||||
|
||||
from common.components import (
|
||||
Fragment,
|
||||
@@ -791,7 +791,7 @@ def _history_section(game: Game) -> SafeText:
|
||||
)
|
||||
|
||||
|
||||
_GET_SESSION_COUNT_SCRIPT = mark_safe(
|
||||
_GET_SESSION_COUNT_SCRIPT = Safe(
|
||||
"<script>\n"
|
||||
" function getSessionCount() {\n"
|
||||
" return document.getElementById('session-count')"
|
||||
|
||||
Reference in New Issue
Block a user