From caab5e357a67f1b939683e89ecda6862a1095c4b Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Fri, 3 Jul 2020 22:13:49 -0400 Subject: [PATCH] Fix crash loading audio attachment uploaded on Mastodon Closes #104 --- Pachyderm/Model/Attachment.swift | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Pachyderm/Model/Attachment.swift b/Pachyderm/Model/Attachment.swift index f71a35fa..cc376dff 100644 --- a/Pachyderm/Model/Attachment.swift +++ b/Pachyderm/Model/Attachment.swift @@ -13,7 +13,7 @@ public class Attachment: Codable { public let kind: Kind public let url: URL public let remoteURL: URL? - public let previewURL: URL + public let previewURL: URL? public let textURL: URL? public let meta: Metadata? public let description: String? @@ -30,11 +30,11 @@ public class Attachment: Codable { self.id = try container.decode(String.self, forKey: .id) self.kind = try container.decode(Kind.self, forKey: .kind) self.url = try container.decode(URL.self, forKey: .url) - self.previewURL = try container.decode(URL.self, forKey: .previewURL) - self.remoteURL = try? container.decode(URL.self, forKey: .remoteURL) - self.textURL = try? container.decode(URL.self, forKey: .textURL) - self.meta = try? container.decode(Metadata.self, forKey: .meta) - self.description = try? container.decode(String.self, forKey: .description) + self.previewURL = try? container.decode(URL?.self, forKey: .previewURL) + self.remoteURL = try? container.decode(URL?.self, forKey: .remoteURL) + self.textURL = try? container.decode(URL?.self, forKey: .textURL) + self.meta = try? container.decode(Metadata?.self, forKey: .meta) + self.description = try? container.decode(String?.self, forKey: .description) } private enum CodingKeys: String, CodingKey {