View Issue Details

IDProjectCategoryView StatusLast Update
0024496mantisbtwikipublic2018-06-06 00:44
Reporterrk4n3 Assigned Tocommunity  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version2.14.0 
Target Version2.15.0Fixed in Version2.15.0 
Summary0024496: URL encoding precludes reasonable wiki root_namespace values
Description

Many wikis (dokuwiki in particular) include characters in their namespace paths that get re-written by URL-encoding the string. For dokuwiki, the character is a colon (':') ... if the root namespace is to live at a path more than one level deep, the namespace separator has to be preserved in the URL. It wouldn't seem reasonable to confine wiki locations to only one level deep because of this.

Steps To Reproduce

Using dokuwiki integration, set the $g_wiki_root_namespace configuration variable to a dokuwiki namespace path more than one level deep, such as "my:wiki:area:for:mantis", then try to use the "Wiki" button(s) in Mantis. Its very clear that the resulting URLs are mangled by the URL-encoding.

Additional Information

I was able to hack my core/classes/MantisCoreWikiPlugin.class.php to fix the issue - everywhere the root_namespace was used, it was separately being URL-encoded, so it was convenient to eliminate the URL-encoding for just that one bit, while preserving the URL-encoding everywhere else.

I would suggest that this is correct/proper, as the root_namespace value doesn't seem to be of any risk requiring URL-encoding to avoid.

TagsNo tags attached.

Relationships

related to 0017871 assignedvboctor The wiki link into mediawiki incorrectly urlencodes the project name 

Activities

dregad

dregad

2018-05-30 04:16

developer   ~0059973

I confirm the issue. Given the following config

$g_wiki_enable = ON;
$g_wiki_engine = 'dokuwiki';
$g_wiki_root_namespace = 'space:mantis';
$g_wiki_engine_url = '/wiki/';

Clicking on the wiki link opens the following, invalid URL: http://localhost:81/wiki/doku.php?id=space%3Amantis:start instead of http://localhost:81/wiki/doku.php?id=space:mantis:start

eliminate the URL-encoding for just [root_namespace], while preserving the URL-encoding everywhere else.
I would suggest that this is correct/proper, as the root_namespace value doesn't seem to be of any risk requiring URL-encoding to avoid.

Considering that the root namespace can only be defined in config_inc.php, I agree with your suggestion.

@rk4n3 would you be willing to submit a GitHub pull request (or patch) with proposed changes for review ?

rk4n3

rk4n3

2018-05-30 09:10

reporter   ~0059976

Last edited: 2018-06-03 06:07

I'm very happy to :)
Pull request #1357 submitted ...

I also checked for further use of the root_namespace variable, and found it fairly isolated:

rk4n3@darkstar:~/src/mantisbt$ find . -type f | grep ".php" | sed "s/^./grep -Hni root_namespace \"&\"/" | bash
./core/classes/MantisCoreWikiPlugin.class.php:41: 'root_namespace' => config_get_global( 'wiki_root_namespace' ),
./core/classes/MantisCoreWikiPlugin.class.php:72: $t_namespace = plugin_config_get( 'root_namespace' );
./core/classes/MantisCoreWikiPlugin.class.php:133: $t_base .= plugin_config_get( 'root_namespace' );
./core/classes/MantisCoreWikiPlugin.class.php:186: $t_namespace = plugin_config_get( 'root_namespace' );
./core/classes/MantisCoreWikiPlugin.class.php:245: $t_namespace = ucfirst( plugin_config_get( 'root_namespace' ) );
./core/classes/MantisCoreWikiPlugin.class.php:306: $t_base .= plugin_config_get( 'root_namespace' );
./config_defaults_inc.php:3924:
@global string $g_wiki_root_namespace
./config_defaults_inc.php:3926:$g_wiki_root_namespace = 'mantis';
./config_defaults_inc.php:4746: 'wiki_root_namespace',

Related Changesets

MantisBT: master 3a2caa07

2018-06-05 07:16

rk4n3

Committer: dregad


Details Diff
Eliminate URL-encoding of root_namespace

This allows use of a root namespace more than one level deep.

Prior to this, use of e.g. `root:mantis` as namespace would result in a
mangled dokuwiki URL because the colon was encoded to `%3A`.

Fixes 0024496
Affected Issues
0024496
mod - core/classes/MantisCoreWikiPlugin.class.php Diff File