server-ts: Port share/shaca/sattachment

This commit is contained in:
Elian Doran
2024-04-09 22:19:54 +03:00
parent 3e4b0d5f91
commit c4c2259e69
4 changed files with 31 additions and 35 deletions

View File

@@ -156,9 +156,9 @@ const STRING_MIME_TYPES = [
"image/svg+xml"
];
function isStringNote(type: string, mime: string) {
function isStringNote(type: string | null, mime: string) {
// render and book are string note in the sense that they are expected to contain empty string
return ["text", "code", "relationMap", "search", "render", "book", "mermaid", "canvas"].includes(type)
return (type && ["text", "code", "relationMap", "search", "render", "book", "mermaid", "canvas"].includes(type))
|| mime.startsWith('text/')
|| STRING_MIME_TYPES.includes(mime);
}