From e66b67dedcb7a8fa0e902b6e03cf65b2575db9e0 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Sat, 23 Mar 2024 09:54:15 +0000 Subject: [PATCH] Only turn binary tiddlers into attachments --- .../multiwikiserver/modules/store/sql-tiddler-store.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/tiddlywiki/multiwikiserver/modules/store/sql-tiddler-store.js b/plugins/tiddlywiki/multiwikiserver/modules/store/sql-tiddler-store.js index 6a7637d5c..a8dd4114f 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/store/sql-tiddler-store.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/store/sql-tiddler-store.js @@ -107,7 +107,9 @@ SqlTiddlerStore.prototype.processIncomingTiddler = function(tiddlerFields) { if(attachmentSizeLimit < 100 * 1024) { attachmentSizeLimit = 100 * 1024; } - if(tiddlerFields.text && tiddlerFields.text.length > attachmentSizeLimit) { + const contentTypeInfo = $tw.config.contentTypeInfo[tiddlerFields.type || "text/vnd.tiddlywiki"], + isBinary = !!contentTypeInfo && contentTypeInfo.encoding === "base64"; + if(isBinary && tiddlerFields.text && tiddlerFields.text.length > attachmentSizeLimit) { const attachment_blob = this.attachmentStore.saveAttachment({ text: tiddlerFields.text, type: tiddlerFields.type,