You are here: Foswiki>Tasks Web>Item12008 (02 Dec 2012, GeorgeClark)Edit Attach

Item12008: Unable to create a topic when its topicparent contains a '+' in its name

pencil
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
Reported By: FlorianSchlichting
Waiting For:
Last Change By: GeorgeClark
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:

  1. create a topic named 'One+Two'
  2. add a reference to a non-existing topic to that newly created topic
  3. click on the new-wikiword link, and click save
  4. 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

 

ItemTemplate edit

Summary Unable to create a topic when its topicparent contains a '+' in its name
ReportedBy FlorianSchlichting
Codebase 1.1.5, trunk
SVN Range
AppliesTo Engine
Component NEWLINKFORMAT, Render.pm / Meta.pm / Foswiki.pm
Priority Normal
CurrentState Closed
WaitingFor
Checkins distro:2908188e694c distro:32ff77bc203a
TargetRelease patch
ReleasedIn 1.1.6
CheckinsOnBranches Release01x01 trunk
trunkCheckins distro:2908188e694c
Release01x01Checkins distro:32ff77bc203a
Topic revision: r7 - 02 Dec 2012, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy