From 98de4b6dc34fdbe18781329fa82b5ae817097a0e Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Fri, 26 Dec 2025 17:31:35 +0200 Subject: [PATCH] chore(icon_pack): map ttf --- apps/server/src/services/icon_packs.spec.ts | 40 +++++++++++++++++++++ apps/server/src/services/icon_packs.ts | 3 +- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/apps/server/src/services/icon_packs.spec.ts b/apps/server/src/services/icon_packs.spec.ts index c4d0ad6ea..02b7bef83 100644 --- a/apps/server/src/services/icon_packs.spec.ts +++ b/apps/server/src/services/icon_packs.spec.ts @@ -60,4 +60,44 @@ describe("Mapping attachments", () => { const attachment = determineBestFontAttachment(iconPackNote); expect(attachment?.mime).toStrictEqual("font/woff"); }); + + it("handles ttf", () => { + const iconPackNote = buildNote({ + type: "text", + attachments: [ + { + role: "file", + title: "Font", + mime: "font/ttf" + } + ] + }); + const attachment = determineBestFontAttachment(iconPackNote); + expect(attachment?.mime).toStrictEqual("font/ttf"); + }); + + it("prefers woff2", () => { + const iconPackNote = buildNote({ + type: "text", + attachments: [ + { + role: "file", + title: "Font", + mime: "font/woff" + }, + { + role: "file", + title: "Font", + mime: "font/ttf" + }, + { + role: "file", + title: "Font", + mime: "font/woff2" + } + ] + }); + const attachment = determineBestFontAttachment(iconPackNote); + expect(attachment?.mime).toStrictEqual("font/woff2"); + }); }); diff --git a/apps/server/src/services/icon_packs.ts b/apps/server/src/services/icon_packs.ts index dd448ed7a..033c0c559 100644 --- a/apps/server/src/services/icon_packs.ts +++ b/apps/server/src/services/icon_packs.ts @@ -4,7 +4,8 @@ import log from "./log"; const PREFERRED_MIME_TYPE = [ "font/woff2", - "font/woff" + "font/woff", + "font/ttf" ]; export interface IconPackManifest {