From e43740c6bc85d4e84a761cc888ecc4c7628f0eb5 Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Wed, 22 Mar 2023 09:35:53 +0500 Subject: [PATCH] editor: add comments for why we use UTITypes --- packages/editor/src/utils/downloader.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/editor/src/utils/downloader.ts b/packages/editor/src/utils/downloader.ts index b65f8f6ad..279e152e3 100644 --- a/packages/editor/src/utils/downloader.ts +++ b/packages/editor/src/utils/downloader.ts @@ -16,10 +16,16 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ + export type DownloadOptions = { corsHost: string; }; +/** + * macOS uses its own Uniform Type Identifier format instead of mime-types. + * This is an incomplete map of UTI->mime-type for image types taken from + * https://gist.github.com/RhetTbull/7221ef3cfd9d746f34b2550d4419a8c2 + */ const UTITypes: Record = { "com.microsoft.bmp": "image/bmp", "com.canon.crw-raw-image": "image/x-canon-crw", @@ -77,6 +83,7 @@ export async function downloadImage(url: string, options?: DownloadOptions) { blob = new Blob([blob], { type: contentType }); + return { blob, url: URL.createObjectURL(blob),