Forum OpenACS Development: ? in URL path with export vars

Collapse
Posted by Dave Bauer on
In some cases a page name entered into Xowiki (for example) could contain a question mark "?" in it.

If this is the case, when links to access the page are generated with export_vars the urls are incorrect.

Export_vars assumes if the passed in -base url contains a ? that it already has query variables, and it does not append the ? before any additional specified query variables.

The only way I can think of solving this is application dependent. If an application wants to generate a URL and it knows the base does not contain query variables but might contain a question mark, the base should be url encoded. Each element of the path would need to be seperately url encoded otherwise the : and / in any url would be urlencoded breaking the url.

Does anyone have a good idea for how to handle this?

Collapse
Posted by Dave Bauer on
1) modify xowiki view method to generate the links by urlencoding the name before making the link

2) modify xowiki make_link method to urlencode the name. THis is only safe if we can be assured only the name and not a path is passed in for the link

3) disallow ? in page names with javascript validation and backend cleanup if necessary.
I recommend A-Z 0-9 _
We have Title for the pretty name and most generated pretty urls are safely created instead of urlencoded.

I prefer #3.

Collapse
Posted by Dave Bauer on
I found a place to fix this in xowiki

in xowiki-www-procs.tcl it uses make_link in the view method for the edit/revisions/delete links.

I did this

set edit_link [export_vars -base [$package_id pretty_link $name] {{m edit}}]