savetiddlers icon indicating copy to clipboard operation
savetiddlers copied to clipboard

doesn't create a backup in tiddlywikilocations/twbackup

Open skierpage opened this issue 4 years ago • 2 comments

I think for a while my mGSD (a TiddlyWiki variant with features) has not been creating backups in ~/Downloads/tiddlywikilocations/twbackup.

I stepped through it and think I see the problem.

saveBackup calls saveFile calls injectedSaveFile (from the extension) and then the event handler messageBox.addEventListener("tiddlyfox-save-file", ... handles the message. But the event handler, instead of getting the path from the "data-tiddlyfox-path" message attribute, at line 92 in contentscript.js) sets path = currentlocation() which gets it from window.location, and in the result in my case is it saves the file and the backup to the same file path.

I think the fix is just to change that one line to

path = message.getAttribute("data-tiddlyfox-path");

I'll attempt a pull request.

skierpage avatar Sep 15 '19 00:09 skierpage

Hi @skierpage, savetiddlers was designed, in the first instance, to work with tw5, and tw5 does not have a backup mechanism. Thus savetiddlers can automatically create a backup (in the case of tw5 this is the default, but is disable by default for twc). There is a checkbox in the addon settings to enable backups for twc, and a box to set the backup directory. I would advise using this method of backups and disable the creation of backups from within your tiddlywikis.

Note that there is a new version as of yesterday that fixes another issue.

buggyj avatar Sep 15 '19 08:09 buggyj

Thanks for the tip! Nevertheless the code is broken; it sets attribute "data-tiddlyfox-path" but never uses it.

skierpage avatar Sep 16 '19 22:09 skierpage