mirror of
https://github.com/docker/docs.git
synced 2026-06-19 07:35:16 +00:00
analytics: fix Marlin endpoint URL double-encoding in head.html
Hugo's html/template JS-escapes string values inside <script> blocks. Calling jsonify per-field produced quoted strings like "https://..." which were then re-escaped, embedding literal quote characters in the endpoint value passed to the SDK. Fix by jsonifying the whole config dict at once and marking it safeJS so html/template does not apply a second round of escaping. Also extract the environment ternary out of the Marlin constructor call for readability. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -82,11 +82,7 @@
|
||||
{{- end -}}
|
||||
{{- if and $apiKey $endpoint -}}
|
||||
<script>
|
||||
window.__marlinConfig = {
|
||||
apiKey: {{ $apiKey | jsonify }},
|
||||
endpoint: {{ $endpoint | jsonify }},
|
||||
environment: {{ $env | jsonify }}
|
||||
};
|
||||
window.__marlinConfig = {{ dict "apiKey" $apiKey "endpoint" $endpoint "environment" $env | jsonify | safeJS }};
|
||||
</script>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
Reference in New Issue
Block a user