fix(pusher): Only strip notification_push_path as a URL suffix

This commit is contained in:
Erwan Leboucher
2026-10-12 11:14:02 +01:00
committed by Jade Ellis
parent 805d4d9416
commit 24e289113b
4 changed files with 11 additions and 20 deletions
+1
View File
@@ -0,0 +1 @@
Fixed push gateway URLs containing the configured notification path outside of their suffix. Contributed by @eleboucher.
+3 -9
View File
@@ -1392,15 +1392,9 @@
#
#emergency_password =
# Specifies the path where push notifications will be sent to a
# push gateway.
#
# When a Matrix client registers for push notifications, it will specify
# a push gateway url where notification events will be sent.
# According to the current spec for Matrix Push Gateways, the path should
# always be "/_matrix/push/v1/notify".
# You should only change this if you have configured your own push gateway
# that requires a different path.
# Suffix stripped from the end of a pusher URL before appending
# "/_matrix/push/v1/notify". Only change this if your pushers register
# URLs ending in a different path.
#
# For more information on Push Gateways: https://spec.matrix.org/latest/push-gateway-api/
#
+3 -9
View File
@@ -1654,15 +1654,9 @@ pub struct Config {
/// display: sensitive
pub emergency_password: Option<String>,
/// Specifies the path where push notifications will be sent to a
/// push gateway.
///
/// When a Matrix client registers for push notifications, it will specify
/// a push gateway url where notification events will be sent.
/// According to the current spec for Matrix Push Gateways, the path should
/// always be "/_matrix/push/v1/notify".
/// You should only change this if you have configured your own push gateway
/// that requires a different path.
/// Suffix stripped from the end of a pusher URL before appending
/// "/_matrix/push/v1/notify". Only change this if your pushers register
/// URLs ending in a different path.
///
/// For more information on Push Gateways: https://spec.matrix.org/latest/push-gateway-api/
///
+4 -2
View File
@@ -304,11 +304,13 @@ pub async fn send_request<T>(&self, dest: &str, request: T) -> Result<T::Incomin
+ Debug
+ Send,
{
let dest = dest.replace(self.services.globals.notification_push_path(), "");
let dest = dest
.strip_suffix(self.services.globals.notification_push_path())
.unwrap_or(dest);
trace!("Push gateway destination: {dest}");
let http_request = request
.try_into_http_request::<BytesMut>(&dest, (), ())
.try_into_http_request::<BytesMut>(dest, (), ())
.map_err(|e| {
err!(BadServerResponse(warn!(
"Failed to find destination {dest} for push gateway: {e}"