From c93bfa73295832dbbbde8b731ffe09b8f87563b2 Mon Sep 17 00:00:00 2001 From: Jed Fox Date: Fri, 20 Jan 2023 16:58:07 -0500 Subject: [PATCH 1/3] Set the `url` property of the Post object before returning it --- MastodonIntent/Handler/SendPostIntentHandler.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/MastodonIntent/Handler/SendPostIntentHandler.swift b/MastodonIntent/Handler/SendPostIntentHandler.swift index afee7d581..8151ac635 100644 --- a/MastodonIntent/Handler/SendPostIntentHandler.swift +++ b/MastodonIntent/Handler/SendPostIntentHandler.swift @@ -97,6 +97,7 @@ extension SendPostIntentHandler: SendPostIntentHandling { subtitle: content, image: response.value.account.avatarImageURL().flatMap { INImage(url: $0) } ) + post.url = URL(string: response.value.url ?? "") posts.append(post) } // end for in From 2374a6552b20302cb2f07e2140c7b0b2192ddd3b Mon Sep 17 00:00:00 2001 From: Jed Fox Date: Tue, 7 Feb 2023 13:37:36 -0500 Subject: [PATCH 2/3] Clarify the logic for setting the URL --- MastodonIntent/Handler/SendPostIntentHandler.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MastodonIntent/Handler/SendPostIntentHandler.swift b/MastodonIntent/Handler/SendPostIntentHandler.swift index 8151ac635..9f17f13dd 100644 --- a/MastodonIntent/Handler/SendPostIntentHandler.swift +++ b/MastodonIntent/Handler/SendPostIntentHandler.swift @@ -97,7 +97,9 @@ extension SendPostIntentHandler: SendPostIntentHandling { subtitle: content, image: response.value.account.avatarImageURL().flatMap { INImage(url: $0) } ) - post.url = URL(string: response.value.url ?? "") + if let urlString = response.value.url { + post.url = URL(string: urlString) + } posts.append(post) } // end for in From a56477b8962c197df0424a0fd14d4180469d97eb Mon Sep 17 00:00:00 2001 From: Jed Fox Date: Tue, 7 Feb 2023 13:47:30 -0500 Subject: [PATCH 3/3] Further tweak --- MastodonIntent/Handler/SendPostIntentHandler.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MastodonIntent/Handler/SendPostIntentHandler.swift b/MastodonIntent/Handler/SendPostIntentHandler.swift index 9f17f13dd..ccf4a57a7 100644 --- a/MastodonIntent/Handler/SendPostIntentHandler.swift +++ b/MastodonIntent/Handler/SendPostIntentHandler.swift @@ -97,8 +97,8 @@ extension SendPostIntentHandler: SendPostIntentHandling { subtitle: content, image: response.value.account.avatarImageURL().flatMap { INImage(url: $0) } ) - if let urlString = response.value.url { - post.url = URL(string: urlString) + if let urlString = response.value.url, let url = URL(string: urlString) { + post.url = url } posts.append(post) } // end for in