Fix error message when app_service_config_files validation fails (#15614)

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 <seanq@matrix.org>
This commit is contained in:
Sean Quah 2023-05-18 10:58:13 +01:00 committed by GitHub
parent 41b9def9f2
commit e15aa00bc0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

1
changelog.d/15614.bugfix Normal file
View file

@ -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.

View file

@ -36,11 +36,10 @@ class AppServiceConfig(Config):
if not isinstance(self.app_service_config_files, list) or not all( 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(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( raise ConfigError(
"Expected '%s' to be a list of AS config files:" "Expected '%s' to be a list of AS config files:"
% (self.app_service_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) self.track_appservice_user_ips = config.get("track_appservice_user_ips", False)