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
1 changed files with 3 additions and 1 deletions

View File

@ -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,