forked from shadowfacts/Tusker
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.
This commit is contained in:
parent
940ba6d6cb
commit
8a45837918
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue