From a288cf754d16d4fdfd3106cda338447f5639771f Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Tue, 3 Oct 2023 13:37:09 -0700 Subject: [PATCH] Fix iOS decoding from JS (#171) * fix: ios decode remote attachments from js * bump the pod spec --- Sources/XMTP/Codecs/RemoteAttachmentCodec.swift | 6 +++--- XMTP.podspec | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/XMTP/Codecs/RemoteAttachmentCodec.swift b/Sources/XMTP/Codecs/RemoteAttachmentCodec.swift index bfd63fc8..fbb552cb 100644 --- a/Sources/XMTP/Codecs/RemoteAttachmentCodec.swift +++ b/Sources/XMTP/Codecs/RemoteAttachmentCodec.swift @@ -174,11 +174,11 @@ public struct RemoteAttachmentCodec: ContentCodec { throw RemoteAttachmentError.invalidScheme("no scheme parameter") } - guard let scheme = RemoteAttachment.Scheme(rawValue: schemeString) else { - throw RemoteAttachmentError.invalidScheme("invalid scheme value. must be https://") + if (!schemeString.starts(with: "https")) { + throw RemoteAttachmentError.invalidScheme("invalid scheme value. must start with https") } - var attachment = try RemoteAttachment(url: url, contentDigest: contentDigest, secret: secret, salt: salt, nonce: nonce, scheme: scheme) + var attachment = try RemoteAttachment(url: url, contentDigest: contentDigest, secret: secret, salt: salt, nonce: nonce, scheme: RemoteAttachment.Scheme.https) if let contentLength = content.parameters["contentLength"] { attachment.contentLength = Int(contentLength) diff --git a/XMTP.podspec b/XMTP.podspec index 92cebc28..91515552 100644 --- a/XMTP.podspec +++ b/XMTP.podspec @@ -16,7 +16,7 @@ Pod::Spec.new do |spec| # spec.name = "XMTP" - spec.version = "0.5.12-alpha0" + spec.version = "0.5.13-alpha0" spec.summary = "XMTP SDK Cocoapod" # This description is used to generate tags and improve search results.