From 30b3463c0b39f2c599fc4a787f8fb9fe7b1c2302 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Thu, 18 Jan 2018 11:07:37 -0500 Subject: [PATCH] Clean up ahead of PR. --- SignalShareExtension/ShareViewController.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/SignalShareExtension/ShareViewController.swift b/SignalShareExtension/ShareViewController.swift index a6c44fd3e..e52af0407 100644 --- a/SignalShareExtension/ShareViewController.swift +++ b/SignalShareExtension/ShareViewController.swift @@ -532,6 +532,15 @@ public class ShareViewController: UINavigationController, ShareViewDelegate, SAE } Logger.info("\(self.logTag) attachment: \(itemProvider)") + // We need to be very careful about which UTI type we use. + // + // * In the case of "textual" shares (e.g. web URLs and text snippets), we want to + // coerce the UTI type to kUTTypeURL or kUTTypeText. + // * We want to treat shared files as file attachments. Therefore we do not + // want to treat file URLs like web URLs. + // * UTIs aren't very descriptive (there are far more MIME types than UTI types) + // so in the case of file attachments we try to refine the attachment type + // using the file extension. guard let srcUtiType = ShareViewController.utiTypeForItem(itemProvider: itemProvider) else { let error = ShareViewControllerError.unsupportedMedia return Promise(error: error)