diff --git a/cli/commands/emoji/add.ts b/cli/commands/emoji/add.ts index 78ade9eb..9ca55a4e 100644 --- a/cli/commands/emoji/add.ts +++ b/cli/commands/emoji/add.ts @@ -121,7 +121,7 @@ export default class EmojiAdd extends BaseCommand { shortcode: args.shortcode, url: getUrl(uploaded.path, config), visibleInPicker: true, - contentType: file.type, + contentType: uploaded.uploadedFile.type, }) .returning(); diff --git a/cli/commands/emoji/import.ts b/cli/commands/emoji/import.ts index 28360eaf..231cfbe1 100644 --- a/cli/commands/emoji/import.ts +++ b/cli/commands/emoji/import.ts @@ -218,7 +218,7 @@ export default class EmojiImport extends BaseCommand { shortcode: emoji.emoji.name, url: getUrl(uploaded.path, config), visibleInPicker: true, - contentType: file.type, + contentType: uploaded.uploadedFile.type, }) .execute(); diff --git a/server/api/api/v1/emojis/:id/index.ts b/server/api/api/v1/emojis/:id/index.ts index 9192925a..7314820b 100644 --- a/server/api/api/v1/emojis/:id/index.ts +++ b/server/api/api/v1/emojis/:id/index.ts @@ -141,7 +141,7 @@ export default (app: Hono) => if (form.element) { // Check of emoji is an image - const contentType = + let contentType = form.element instanceof File ? form.element.type : await mimeLookup(form.element); @@ -166,6 +166,7 @@ export default (app: Hono) => const uploaded = await media.addFile(form.element); url = uploaded.path; + contentType = uploaded.uploadedFile.type; } else { url = form.element; } diff --git a/server/api/api/v1/emojis/index.ts b/server/api/api/v1/emojis/index.ts index 9610a821..5f639966 100644 --- a/server/api/api/v1/emojis/index.ts +++ b/server/api/api/v1/emojis/index.ts @@ -100,7 +100,7 @@ export default (app: Hono) => let url = ""; // Check of emoji is an image - const contentType = + let contentType = element instanceof File ? element.type : await mimeLookup(element); @@ -121,6 +121,7 @@ export default (app: Hono) => const uploaded = await media.addFile(element); url = uploaded.path; + contentType = uploaded.uploadedFile.type; } else { url = element; }