Skip to content

Build your personal knowledge base with Trilium Notes

chore(icon_pack): map ttf

Elian Doran98de4b6dc34f
diff --git a/apps/server/src/services/icon_packs.spec.ts b/apps/server/src/services/icon_packs.spec.ts
index c4d0ad6ea5..02b7bef83a 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 dd448ed7a0..033c0c5597 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 {