mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Fixed a bug where the OpenGroup url parsing wasn't working for a certain URL structure
This commit is contained in:
parent
d3e9fff893
commit
452614d190
1 changed files with 4 additions and 1 deletions
|
@ -126,7 +126,10 @@ public final class OpenGroupManagerV2 : NSObject {
|
|||
// https://143.198.213.225:443/main?public_key=658d29b91892a2389505596b135e76a53db6e11d613a51dbd3d0816adffb231c
|
||||
// 143.198.213.255:80/main?public_key=658d29b91892a2389505596b135e76a53db6e11d613a51dbd3d0816adffb231c
|
||||
let useTLS = (url.scheme == "https")
|
||||
let updatedPath = (url.path.starts(with: "/r/") ? url.path.substring(from: 2) : url.path)
|
||||
|
||||
// If there is no scheme then the host is included in the path (so handle that case)
|
||||
let hostFreePath = (url.host != nil || !url.path.starts(with: host) ? url.path : url.path.substring(from: host.count))
|
||||
let updatedPath = (hostFreePath.starts(with: "/r/") ? hostFreePath.substring(from: 2) : hostFreePath)
|
||||
let room = String(updatedPath.dropFirst()) // Drop the leading slash
|
||||
let queryParts = query.split(separator: "=")
|
||||
guard !room.isEmpty && !room.contains("/"), queryParts.count == 2, queryParts[0] == "public_key" else { return nil }
|
||||
|
|
Loading…
Reference in a new issue