From f3ada853b028c0f38cf97c8c85f72c1b641af7d2 Mon Sep 17 00:00:00 2001 From: Sean Quah Date: Wed, 17 May 2023 18:08:06 +0100 Subject: [PATCH 1/2] Fix error message when `app_service_config_files` validation fails The second argument of `ConfigError` is a path, passed as an optional `Iterable[str]` and not a `str`. If a string is passed directly, Synapse unhelpfully emits "Error in configuration at 'a.p.p._.s.e.r.v.i.c.e._.c.o.n.f.i.g._.f.i.l.e.s'" when the config option has the wrong data type. Signed-off-by: Sean Quah --- synapse/config/appservice.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/synapse/config/appservice.py b/synapse/config/appservice.py index fd89960e7261..c2710fdf0410 100644 --- a/synapse/config/appservice.py +++ b/synapse/config/appservice.py @@ -36,11 +36,10 @@ def read_config(self, config: JsonDict, **kwargs: Any) -> None: if not isinstance(self.app_service_config_files, list) or not all( type(x) is str for x in self.app_service_config_files ): - # type-ignore: this function gets arbitrary json value; we do use this path. raise ConfigError( "Expected '%s' to be a list of AS config files:" % (self.app_service_config_files), - "app_service_config_files", + ("app_service_config_files",), ) self.track_appservice_user_ips = config.get("track_appservice_user_ips", False) From 2dbc61dba7cfe2549aa38646660afa79c8a0c981 Mon Sep 17 00:00:00 2001 From: Sean Quah Date: Wed, 17 May 2023 18:29:57 +0100 Subject: [PATCH 2/2] Add newsfile --- changelog.d/15614.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/15614.bugfix diff --git a/changelog.d/15614.bugfix b/changelog.d/15614.bugfix new file mode 100644 index 000000000000..b523ae6eb19c --- /dev/null +++ b/changelog.d/15614.bugfix @@ -0,0 +1 @@ +Fix a bug introduced in Synapse 1.82.0 where the error message displayed when validation of the `app_service_config_files` config option fails would be incorrectly formatted.