Ticket #1177 (closed defect: fixed)
[TiddlyWebWiki] double-encoding in ServerSideSavingPlugin
|Reported by:||jdlrobson||Owned by:||jdlrobson|
Description (last modified by FND) (diff)
I noticed an error in saving.
To replicate this error you will need:
- 1 bag with a name jdlrobson%40gmail.com (the unencoded form of this is email@example.com)
- up to date tiddlyweb and tiddlywebwiki
- a recipe referencing the bag firstname.lastname@example.org and the system bag with the correct permissioning to allow you to edit
Create a tiddler in this new bag with Firebug open. You will notice it saves correctly. Click edit and try again. This time a 412 is thrown saying the ETag is incorrect.
Looking more closely you will notice that normalizeTitle normalises the field server.bag on the tiddler (in TiddlyWebAdaptor?). Somehow this also modifies the tiddler object itself so now that tiddler has a field server.bag with value jdlrobson%40gmail.com.
When you save a second or third time, it tries to normalise yet again, which then causes an error.
One slightly hacky way which solves the problem is to add:
if(context && context.tiddler && context.tiddler.fields['server.workspace'])context.tiddler.fields['server.workspace'] = decodeURIComponent(context.tiddler.fields['server.workspace']);
to saveTiddlerCallback. This resets the field that has been modified. Sure there is a better solution out there though.