From 8a4583791886af7e355c0f68e1c02a67cf123024 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Thu, 13 Jun 2019 23:48:21 -0700 Subject: [PATCH] Fix loading attachments from Pleroma Unlike Mastodon, Pleroma includes a URL query component in attachment URLs. The URL(lenient:) initializer did not count query parameters (e.g. '?') as valid URL characters and incorrectly escaped them resulting in image requests that 404'd. --- Pachyderm/Model/Attachment.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Pachyderm/Model/Attachment.swift b/Pachyderm/Model/Attachment.swift index 1ab4b980..b9663bc6 100644 --- a/Pachyderm/Model/Attachment.swift +++ b/Pachyderm/Model/Attachment.swift @@ -115,7 +115,7 @@ extension Attachment { } fileprivate extension URL { - private static let allowedChars = CharacterSet.urlHostAllowed.union(.urlPathAllowed) + private static let allowedChars = CharacterSet.urlHostAllowed.union(.urlPathAllowed).union(.urlQueryAllowed) init?(lenient string: String) { guard let escaped = string.addingPercentEncoding(withAllowedCharacters: URL.allowedChars) else {