From e37fe1f8f5171c9992edb2b6d58a91a1fdb8dfb4 Mon Sep 17 00:00:00 2001 From: jonnyandrew Date: Tue, 2 May 2023 10:05:15 +0000 Subject: [PATCH] Allow custom push gateway to use non-default port (#8376) --- changelog.d/8376.bugfix | 1 + .../main/java/im/vector/app/core/pushers/UnifiedPushHelper.kt | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelog.d/8376.bugfix diff --git a/changelog.d/8376.bugfix b/changelog.d/8376.bugfix new file mode 100644 index 0000000000..2c30a1e540 --- /dev/null +++ b/changelog.d/8376.bugfix @@ -0,0 +1 @@ +Allow custom push gateway to use non-default port \ No newline at end of file diff --git a/vector/src/main/java/im/vector/app/core/pushers/UnifiedPushHelper.kt b/vector/src/main/java/im/vector/app/core/pushers/UnifiedPushHelper.kt index 9f96f13ee7..77fed03c8a 100644 --- a/vector/src/main/java/im/vector/app/core/pushers/UnifiedPushHelper.kt +++ b/vector/src/main/java/im/vector/app/core/pushers/UnifiedPushHelper.kt @@ -104,7 +104,8 @@ class UnifiedPushHelper @Inject constructor( // else, unifiedpush, and pushkey is an endpoint val gateway = stringProvider.getString(R.string.default_push_gateway_http_url) val parsed = URL(endpoint) - val custom = "${parsed.protocol}://${parsed.host}/_matrix/push/v1/notify" + val port = if (parsed.port != -1) { ":${parsed.port}" } else { "" } + val custom = "${parsed.protocol}://${parsed.host}${port}/_matrix/push/v1/notify" Timber.i("Testing $custom") try { val response = matrix.rawService().getUrl(custom, CacheStrategy.NoCache)