allowing the push endpoint querying to fail

This commit is contained in:
Adam Brown 2022-08-18 21:37:03 +01:00
parent 1ed4248e13
commit 219b520dff
1 changed files with 1 additions and 1 deletions

View File

@ -45,7 +45,7 @@ class UnifiedPushMessageReceiver : MessagingReceiver() {
scope.launch {
withContext(module.dispatcher().io) {
val matrixEndpoint = URL(endpoint).let { URL("${it.protocol}://${it.host}/_matrix/push/v1/notify") }
val content = matrixEndpoint.openStream().use { String(it.readBytes()) }
val content = runCatching { matrixEndpoint.openStream().use { String(it.readBytes()) } }.getOrNull() ?: ""
val gatewayUrl = when {
content.contains("\"gateway\":\"matrix\"") -> matrixEndpoint.toString()
else -> FALLBACK_UNIFIED_PUSH_GATEWAY