Details
Description
Reproduction steps:
- Setup the servlet engine to support backslashes in URLs
- On administration > Edition > Name strategies remove "\" from the forbidden characters in page names
- Create a new empty template wiki and leave it empty
- Go in the template wiki and create a page with a "\" in its path
- Create a new wiki from the template you just edited
Expected result:
- The wiki creation UI displays that it's successfully created
Obtained result:
- The UI get stuck very quickly during the wiki creation
Old description with other steps:
We serialize in JSON all the job logs to be able to display them to the users, but apparently when a stack trace concerning a file is outputted in the logs, it break JSON serialization on Windows.
See the attached JSON.
Reproduction steps:
- Create a page with the following snippet:
{{velocity}} #if ($xcontext.action == 'get' && "$!{request.outputSyntax}" == 'plain') #set($discard = $response.setContentType('application/json')) #set ($message = "File not found exception: C:\MyFile\Somewhere\There") #set ($logs = [$escapetool.xml($message)]) #set($map = {'wikiId':"myId", 'logs':$logs}) $jsontool.serialize($map) #end {{/velocity}}
- Call the page with get action and ?outputSyntax=plain, e.g.:
http://localhost:8080/xwiki/bin/get/Test/?outputSyntax=plain
Expected result:
- the produced JSON is correct
Obtained result:
- the following broken JSON:
{"wikiId":"myId","logs":["File not found exception: C: MyFile Somewhere There"]}
Edit: actually the snippet is even easier to write:
{{velocity}} #set ($message = "File not found exception: C:\MyFile\Somewhere\There") $jsontool.serialize($message) {{/velocity}}
shouldn't create any line break.
Attachments
Issue Links
- is duplicated by
-
XWIKI-17886 Subwiki creation from template process gets stuck and does not complete
- Closed