Escape less than sign

Otherwise tiddlers containing `</script>` will break TiddlyWiki
This commit is contained in:
Jeremy Ruston 2024-01-23 16:52:49 +00:00
parent ff184822ca
commit 4d42d4a190
1 changed files with 3 additions and 3 deletions

View File

@ -50,11 +50,11 @@ exports.handler = function(request,response,state) {
}
response.write(template.substring(0,markerPos + marker.length));
$tw.utils.each(recipeTiddlers,function(recipeTiddlerInfo) {
response.write(JSON.stringify($tw.sqlTiddlerStore.getRecipeTiddler(recipeTiddlerInfo.title,recipe_name).tiddler));
response.write(",")
response.write(JSON.stringify($tw.sqlTiddlerStore.getRecipeTiddler(recipeTiddlerInfo.title,recipe_name).tiddler).replace(/</g,"\\u003c"));
response.write(",\n")
});
response.write(JSON.stringify({title: "$:/config/tiddlyweb/host",text: "$protocol$//$host$$pathname$/"}));
response.write(",")
response.write(",\n")
response.write(template.substring(markerPos + marker.length))
// Finish response
response.end();