From 48bd957276c211d85536e0f8ab3cb4c859a7af42 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Wed, 10 May 2023 10:40:27 -0400 Subject: [PATCH] Fix nodeinfo not being fetched on punycode domains --- Packages/Pachyderm/Sources/Pachyderm/Client.swift | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Packages/Pachyderm/Sources/Pachyderm/Client.swift b/Packages/Pachyderm/Sources/Pachyderm/Client.swift index f1808ec3..ab3c4c55 100644 --- a/Packages/Pachyderm/Sources/Pachyderm/Client.swift +++ b/Packages/Pachyderm/Sources/Pachyderm/Client.swift @@ -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(method: .get, path: Endpoint(stringLiteral: components.path)) + let href = WebURL(url.href), + href.host == WebURL(self.baseURL)?.host { + let nodeInfo = Request(method: .get, path: Endpoint(stringLiteral: href.path)) self.run(nodeInfo, completion: completion) } }