spaghetti

https://github.com/binwiederhier/ntfy/issues/271
This commit is contained in:
Curid 2022-05-26 18:15:06 +00:00 committed by GitHub
parent b2e3ed7418
commit cd5931be16
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -95,7 +95,12 @@ class DetailActivity : AppCompatActivity(), ActionMode.Callback, NotificationFra
return
}
val secure = url.getBooleanQueryParameter("secure", true)
val baseUrl = if (secure) "https://${url.host}" else "http://${url.host}"
val urlWithoutProto = url.fullURL[7:]
val lastSlashIndex = urlWithoutProto.lastIndexOf("/")
val url2 = urlWithoutProto[:lastSlashIndex]
val baseUrl = if (secure) "https://${url2}" else "http://${url2}"
val topic = url.pathSegments.first()
title = topicShortUrl(baseUrl, topic)