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 {