Item12008: Unable to create a topic when its topicparent contains a '+' in its name
Priority: Normal
Current State: Closed
Released In: 1.1.6
Target Release: patch
Applies To: Engine
Component: NEWLINKFORMAT, Render.pm / Meta.pm / Foswiki.pm
Branches: Release01x01 trunk
It is not possible to create a new topic by clicking on the non-existing wikiword link, when the name of the parent topic contains a plus sign.
To reproduce:
- create a topic named 'One+Two'
- add a reference to a non-existing topic to that newly created topic
- click on the new-wikiword link, and click save
- error message "'One Two' is not a valid value for the 'topicparent' parameter" results
The reason for this is that a + is an url-encoded space, and must be encoded to %2b to be preserved as a plus.
What seems to happen is that
Render.pm::_renderNonExistingWikiWord()
calls
$topicObject->expandMacros()
on a value such as
<a href="%SCRIPTURLPATH{"edit"}%/MyWeb/MyNewTopic?topicparent=%WEB%.%TOPIC%" ...
and TOPIC gets expanded to something that is not url-encoded.
IMHO, one way to fix this would be to use ENCODE on WEB and TOPIC for NEWLINKFORMAT in
DefaultPreferences as well as DEFAULT_NEWLINKFORMAT in Render.pm. But since this problem might lurk in other places as well, a new expandMacrosEncoded() method in Meta.pm/Foswiki.pm might be worth it?
--
FlorianSchlichting - 20 Jul 2012
I
think the encoding has to happen in the NEWLINKFORMAT as you suggest, as the url being sent to the foswiki server needs to be safe'd - applying this change allows me to make topics called Sandbox.Auto+Test-Moreµ and both the unencoded and encoded Url go to the same topic.
--
SvenDowideit - 03 Oct 2012 - 04:01