Skip to content

Build your personal knowledge base with Trilium Notes

fix(server): blob errors out

Elian Doranc7f0d541c2de
diff --git a/apps/server/src/services/blob.ts b/apps/server/src/services/blob.ts
index 6804f1ecb5..2f123cb03f 100644
--- a/apps/server/src/services/blob.ts
+++ b/apps/server/src/services/blob.ts
@@ -39,7 +39,9 @@ function processContent(content: Buffer | Uint8Array | string | null, isProtecte
}
if (isStringContent) {
- return content === null ? "" : binary_utils.decodeUtf8(content as Uint8Array);
+ if (content === null) return "";
+ if (typeof content === "string") return content;
+ return binary_utils.decodeUtf8(content as Uint8Array);
}
// see https://github.com/zadam/trilium/issues/3523
// IIRC a zero-sized buffer can be returned as null from the database