From 58bf4fe34bf793cc38d858b3a4130769dcae5c98 Mon Sep 17 00:00:00 2001 From: tripleawwy <43851917+tripleawwy@users.noreply.github.com> Date: Mon, 2 Mar 2026 12:31:57 +0100 Subject: [PATCH] fix: conditionally include m.identity_server in Element Web config.json When no identity server is configured, `matrix_client_element_default_is_url` defaults to `~` (YAML null). The `| string | to_json` filter chain converts this to the literal string `"None"`, causing Element Web to log errors: - TypeError: URL constructor: None is not a valid URL - Invalid base_url for m.identity_server The well-known template (`.well-known/matrix/client.j2`) already handles this correctly with a conditional guard (see PR #314). This applies the same pattern to the Element Web `config.json.j2` template. --- roles/custom/matrix-client-element/templates/config.json.j2 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/roles/custom/matrix-client-element/templates/config.json.j2 b/roles/custom/matrix-client-element/templates/config.json.j2 index 4a2ec1c5f..c9bc9e3f9 100644 --- a/roles/custom/matrix-client-element/templates/config.json.j2 +++ b/roles/custom/matrix-client-element/templates/config.json.j2 @@ -3,10 +3,12 @@ "m.homeserver": { "base_url": {{ matrix_client_element_default_hs_url | string | to_json }}, "server_name": {{ matrix_client_element_default_server_name | string | to_json }} - }, + } + {% if matrix_client_element_default_is_url %}, "m.identity_server": { "base_url": {{ matrix_client_element_default_is_url | string | to_json }} } + {% endif %} }, "setting_defaults": { "custom_themes": {{ matrix_client_element_setting_defaults_custom_themes | to_json }}