I plan to work on a R package to convert R markdown file into a tiddler. The aim is directly PUT output from RMarkdown into a new/existing tiddler using R interface.
After reading the documentation, I understand a new tiddler can be created using PUT tiddler API. But I cannot find an API to PUT a file.
I would like to add all images as external files (i.e. under files folder).
@Zheng_Bangyou you can add a route to the server by writing a plugin. I use this approach in my WebDAV work to allow saving files to the files folder from the wiki, along with the FileUploads plugin.
Below is an example of a route that allows PUT to the files folder. Note that it assumes that the file path received is a valid file path with a valid file name:
That is a good start, but will be vulnerable to encoded-parameter attacks (titles that start with “../” will allow you to escape the “/files” folder). The Syncer->Filesystem plugin does some checks for tiddlers that you could use for this. I think those checks should be generalized at some point, especially if we open up file uploading on node.
It is a proof of concept as to what form FileUploads support for node.js could take, and comes with a warning in bold red in the plugin. I do not intend to work on this further unless there is consensus on how we want to approach FileUploads support for node.js