Fix nodeinfo not being fetched on punycode domains

This commit is contained in:
Shadowfacts 2023-05-10 10:40:27 -04:00
parent d4d42e7856
commit 48bd957276
1 changed files with 4 additions and 3 deletions

View File

@ -7,6 +7,7 @@
//
import Foundation
import WebURL
/**
The base Mastodon API client.
@ -186,9 +187,9 @@ public class Client {
case let .success(wellKnown, _):
if let url = wellKnown.links.first(where: { $0.rel == "http://nodeinfo.diaspora.software/ns/schema/2.0" }),
let components = URLComponents(string: url.href),
components.host == self.baseURL.host {
let nodeInfo = Request<NodeInfo>(method: .get, path: Endpoint(stringLiteral: components.path))
let href = WebURL(url.href),
href.host == WebURL(self.baseURL)?.host {
let nodeInfo = Request<NodeInfo>(method: .get, path: Endpoint(stringLiteral: href.path))
self.run(nodeInfo, completion: completion)
}
}