[server] tiddler saved in json no matter the type

I have a few tiddler which are saved in json in my tiddlywiki server, no matter their type, which is normally tw5. And I must have them saved according to my conventions, shown below.

$:/config/FileSystemExtensions :

[field:type[application/x-tiddler-dictionary]then[.dic]]
[field:type[text/vnd.tiddlywiki]then[.tw5]]
[field:type[]then[.tw5]]
[field:type[text/plain]then[.txt]]

$:/config/FileSystemPaths :

[is[system]!has[draft.of]removeprefix[$:/]search-replace:g[_],[-]search-replace:g:regexp[/+],[_]slugify[]search-replace:g:regexp[(-|\.)*_+(-|\.)*],[/]search-replace:g:regexp[^\.+(-*|\.*)*|\.+],[.]search-replace:g:regexp[-\.|\.-],[-]search-replace:g:regexp[^-|^\.|-$|\.$|_$],[]addprefix[_system/]]
[is[draft]slugify[]addprefix[_drafts/]]
[!is[system]slugify[]search-replace:g:regexp[_+],[-]search-replace:g:regexp[^\.+(-*|\.*)*|\.+],[.]search-replace:g:regexp[-\.|\.-],[-]search-replace:g:regexp[-+],[-]search-replace:g:regexp[^-|^\.|-$|\.$|_$],[]]

With investigation, I found out that the transformation to json is made whenever a field of the tiddler has a value beginning of finishing with a space! This is reversible.

But where is the bug?

Any tiddler that cannot be saved in the .tid file format is saved as JSON. The format does not allow leading or trailing whitespace, nor multi-line content.

From the documentation:

Normally, the file system extension of a tiddler on disk is determined by the presence of field values containing newlines or field values that start or end with whitespace (other than the text field), in which case the single file “.json” tiddler file format is used.

@saqimtiaz The space is not in the tiddler title, not in the field name, but at the beginning or at the end of the field value.

BUT I have found out two other affected tiddlers where there is no such spaces in their fields and yet are saved in json.

Here are these tiddlers names:

  • $:/user/core/forms/pageCreateForm
  • $:/user/core/forms/campaignsListForm

I shall do further investigations on my own.

I have an other tiddler where, by design, I have fields ending with a space. So if thi json saving in that case is not a feature but a bug, I would hope to have it fixed.

Also’ note that my tiddler are normally save saved as .tw5 for the text and as .tw5.meta for the header (which is the header of the .tid file).

As the documentation states, any tiddler with a field value that starts or ends with whitespace is saved as .json

Thank you @saqimtiaz!

So it’s not a bug… I found it in the doc ( Customising Tiddler File Naming). Should be more obvious though.