mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-21 21:51:44 +02:00
Removing multiple relays in the same line.
This commit is contained in:
@@ -95,6 +95,14 @@ class RelayUrlNormalizer {
|
|||||||
@OptIn(ExperimentalContracts::class)
|
@OptIn(ExperimentalContracts::class)
|
||||||
fun fix(url: String): String? {
|
fun fix(url: String): String? {
|
||||||
if (url.length < 3) return null
|
if (url.length < 3) return null
|
||||||
|
if (url.length > 100) {
|
||||||
|
// removes multiple urls in the same line
|
||||||
|
val schemeIdx = url.indexOf("://")
|
||||||
|
val nextScheme = url.indexOf("://", schemeIdx + 3)
|
||||||
|
if (nextScheme > 0) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val trimmed =
|
val trimmed =
|
||||||
if (url[0].isWhitespace() || url[url.length - 1].isWhitespace()) {
|
if (url[0].isWhitespace() || url[url.length - 1].isWhitespace()) {
|
||||||
|
Reference in New Issue
Block a user