From 82e7bf9f96bb334f94a483e9c9de0c5c583a7314 Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Fri, 20 Jan 2023 00:44:46 +0100 Subject: Add detection for gifs when uploading emojis !!UNTESTED!! Signed-off-by: TheArcaneBrony --- src/api/util/utility/Base64.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/api/util/utility') diff --git a/src/api/util/utility/Base64.ts b/src/api/util/utility/Base64.ts index 892e0ada..a1e7931f 100644 --- a/src/api/util/utility/Base64.ts +++ b/src/api/util/utility/Base64.ts @@ -64,3 +64,14 @@ export const bton = (base64: string) => { return sign ? -number : number; }; + +// Rory - 20/01/2023 - Add utility functions to aid with identification of file types in emojis +export const toByteArray = (str: string) => { + let binary_string = atob(str); + let len = binary_string.length; + let bytes = new Uint8Array(len); + for (let i = 0; i < len; i++) { + bytes[i] = binary_string.charCodeAt(i); + } + return bytes; +}; -- cgit 1.5.1