I am trying to modify the default filters to customize file path for uploads in the WebDav Utils plug in.
Here is what I am trying to do:
Whenever I am editing a tiddler, this tiddler will become the currentTiddler. I have a field in this tiddler whose fieldvalue will be the name of the subfolder in which the image when drag-dropped should be saved.
As discussed in this post, using this filter
{{{ [{$:/HistoryList!!current-tiddler}fields[]prefix[sub-]] :map[{$:/HistoryList!!current-tiddler}get{!!title}addsuffix[/]] }}}
I will get this folder name for saving the image.
Now I want this be integrated into the filter for file path for uploads. So I made a function
for this filter called upload-path
in a tiddler tagged with $:/tags/Macro
.
\function upload-path()
[{$:/HistoryList!!current-tiddler}fields[]prefix[sub-]] :map[{$:/HistoryList!!current-tiddler}get{!!title}addsuffix[/]]
\end upload-path
Then I modified the filters to customize file path in the WebDav Utils plug in as
\\ last filter matches all remaining tiddlers. replace forward and back slashes and place it inside the default upload directory
[search-replace:g:regexp[/|\\],[_]addprefix<upload-path>addprefix{$:/config/file-uploads/webdav/defaultUploadDirectory}]
But this is not saving the image in the subfolder as intented, but in the files
folder . Can somoene help ?