Skip to content

Commit 156c23b

Browse files
authored
Trim the secret read by the matrix.secret_file configuration option (#4961)
2 parents f111c09 + 823c60f commit 156c23b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

crates/config/src/sections/matrix.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,11 @@ impl MatrixConfig {
131131
/// Returns an error when the shared secret could not be read from file.
132132
pub async fn secret(&self) -> anyhow::Result<String> {
133133
Ok(match &self.secret {
134-
Secret::File(path) => tokio::fs::read_to_string(path).await?,
134+
Secret::File(path) => {
135+
let raw = tokio::fs::read_to_string(path).await?;
136+
// Trim the secret when read from file to match Synapse's behaviour
137+
raw.trim().to_string()
138+
}
135139
Secret::Value(secret) => secret.clone(),
136140
})
137141
}

0 commit comments

Comments
 (0)