1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 03:57:21 +00:00

Allow attachment handling to be switched off

This commit is contained in:
Jeremy Ruston 2024-07-16 10:32:34 +01:00
parent b4664bd7d1
commit 066771e6e9
2 changed files with 4 additions and 1 deletions

View File

@ -0,0 +1,2 @@
title: $:/config/MultiWikiServer/EnableAttachments
text: no

View File

@ -148,9 +148,10 @@ SqlTiddlerStore.prototype.processIncomingTiddler = function(tiddlerFields) {
if(attachmentSizeLimit < 100 * 1024) {
attachmentSizeLimit = 100 * 1024;
}
const attachmentsEnabled = this.adminWiki.getTiddlerText("$:/config/MultiWikiServer/EnableAttachments","yes") === "yes";
const contentTypeInfo = $tw.config.contentTypeInfo[tiddlerFields.type || "text/vnd.tiddlywiki"],
isBinary = !!contentTypeInfo && contentTypeInfo.encoding === "base64";
if(isBinary && tiddlerFields.text && tiddlerFields.text.length > attachmentSizeLimit) {
if(attachmentsEnabled && isBinary && tiddlerFields.text && tiddlerFields.text.length > attachmentSizeLimit) {
const attachment_blob = this.attachmentStore.saveAttachment({
text: tiddlerFields.text,
type: tiddlerFields.type,