1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-01-07 16:00:28 +00:00

Only turn binary tiddlers into attachments

This commit is contained in:
Jeremy Ruston 2024-03-23 09:54:15 +00:00
parent a2012dcff8
commit e66b67dedc

View File

@ -107,7 +107,9 @@ SqlTiddlerStore.prototype.processIncomingTiddler = function(tiddlerFields) {
if(attachmentSizeLimit < 100 * 1024) { if(attachmentSizeLimit < 100 * 1024) {
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({ const attachment_blob = this.attachmentStore.saveAttachment({
text: tiddlerFields.text, text: tiddlerFields.text,
type: tiddlerFields.type, type: tiddlerFields.type,