Fixed an issue where open groups with no scheme in the url might not match correctly

This commit is contained in:
Morgan Pretty 2022-03-21 14:32:48 +11:00
parent a7895d6581
commit 7ae1342341

View file

@ -31,7 +31,9 @@ public final class OpenGroupManagerV2 : NSObject {
// MARK: Adding & Removing
public func hasExistingOpenGroup(room: String, server: String, publicKey: String, using transaction: YapDatabaseReadWriteTransaction) -> Bool {
let schemeFreeServer: String = (server.starts(with: "https://") ? server.substring(from: "https://".count) : server.substring(from: "http://".count))
guard let serverUrl: URL = URL(string: server) else { return false }
let schemeFreeServer: String = (serverUrl.host ?? server)
let schemeFreeDefaultServer: String = OpenGroupAPIV2.defaultServer.substring(from: "http://".count)
var serverOptions: Set<String> = Set([
schemeFreeServer,