From ef138e69348d9e2db09c3bd36348a629a9a55f14 Mon Sep 17 00:00:00 2001 From: Sean Kelley Date: Sun, 28 Dec 2025 11:49:56 -0800 Subject: [PATCH] Manually URL re-encode everything so pluses and other regex characters survive. --- .../Networking/EndpointRequests/EndpointRequest.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Sources/ScryfallKit/Networking/EndpointRequests/EndpointRequest.swift b/Sources/ScryfallKit/Networking/EndpointRequests/EndpointRequest.swift index b171b7b..c4c619b 100644 --- a/Sources/ScryfallKit/Networking/EndpointRequests/EndpointRequest.swift +++ b/Sources/ScryfallKit/Networking/EndpointRequests/EndpointRequest.swift @@ -15,8 +15,10 @@ protocol EndpointRequest { extension EndpointRequest { var urlRequest: URLRequest? { var urlComponents = URLComponents(string: "https://api.scryfall.com/\(path)") - if !queryParams.isEmpty { - urlComponents?.queryItems = queryParams.compactMap { $0.value == nil ? nil : $0 } + urlComponents?.queryItems = queryParams.compactMap { $0.value == nil ? nil : $0 } + let queryItems = urlComponents?.queryItems + urlComponents?.percentEncodedQueryItems = queryItems?.map { + URLQueryItem(name: $0.name, value: $0.value?.addingPercentEncoding(withAllowedCharacters: .alphanumerics)) } guard let url = urlComponents?.url else {