From 8cd8e9d1be54fcd5b7dae626e8abd3189b9709bf Mon Sep 17 00:00:00 2001 From: Robinson Date: Tue, 7 Jun 2022 23:11:00 +0200 Subject: [PATCH] Fixed typo with cleanupAndRemovePath --- src/dorkbox/util/WebUtil.kt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/dorkbox/util/WebUtil.kt b/src/dorkbox/util/WebUtil.kt index 301ef58..d40ab39 100644 --- a/src/dorkbox/util/WebUtil.kt +++ b/src/dorkbox/util/WebUtil.kt @@ -136,7 +136,14 @@ object WebUtil { * https://www.aa.foo.com%foobar --> https://www.aa.foo.com */ fun cleanupAndRemovePath(fullDomainName: String): String { - val start = 0 + var start = fullDomainName.indexOf("://") + if (start == -1) { + start = 0 + } + else { + start += 3 // 3 is the length of :// + } + var end = fullDomainName.length val slash = fullDomainName.indexOf("/", start + 3) @@ -165,7 +172,7 @@ object WebUtil { } - return fullDomainName.substring(start, end) + return fullDomainName.substring(0, end) }