From 823c60f43df3ad0a72e9ac4a8479396fa3cf8328 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Sat, 30 Aug 2025 18:01:22 +0200 Subject: [PATCH] Trim matrix secret when read from file Treat the secret the same as synapse when read from file a file, so that the same secret file can be reused between mas and synapse. https://github.com/element-hq/synapse/blob/v1.137.0/synapse/config/experimental.py#L50 --- crates/config/src/sections/matrix.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/config/src/sections/matrix.rs b/crates/config/src/sections/matrix.rs index e2330a7a5..1b08c1a07 100644 --- a/crates/config/src/sections/matrix.rs +++ b/crates/config/src/sections/matrix.rs @@ -131,7 +131,11 @@ impl MatrixConfig { /// Returns an error when the shared secret could not be read from file. pub async fn secret(&self) -> anyhow::Result { Ok(match &self.secret { - Secret::File(path) => tokio::fs::read_to_string(path).await?, + Secret::File(path) => { + let raw = tokio::fs::read_to_string(path).await?; + // Trim the secret when read from file to match Synapse's behaviour + raw.trim().to_string() + } Secret::Value(secret) => secret.clone(), }) }