Fix nodeinfo not being fetched on punycode domains
This commit is contained in:
parent
d4d42e7856
commit
48bd957276
|
@ -7,6 +7,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
import WebURL
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The base Mastodon API client.
|
The base Mastodon API client.
|
||||||
|
@ -186,9 +187,9 @@ public class Client {
|
||||||
|
|
||||||
case let .success(wellKnown, _):
|
case let .success(wellKnown, _):
|
||||||
if let url = wellKnown.links.first(where: { $0.rel == "http://nodeinfo.diaspora.software/ns/schema/2.0" }),
|
if let url = wellKnown.links.first(where: { $0.rel == "http://nodeinfo.diaspora.software/ns/schema/2.0" }),
|
||||||
let components = URLComponents(string: url.href),
|
let href = WebURL(url.href),
|
||||||
components.host == self.baseURL.host {
|
href.host == WebURL(self.baseURL)?.host {
|
||||||
let nodeInfo = Request<NodeInfo>(method: .get, path: Endpoint(stringLiteral: components.path))
|
let nodeInfo = Request<NodeInfo>(method: .get, path: Endpoint(stringLiteral: href.path))
|
||||||
self.run(nodeInfo, completion: completion)
|
self.run(nodeInfo, completion: completion)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue