Skip to content

Commit 54f18c5

Browse files
committed
Fix #54 adding ':' to absolute ids in the root namespace
1 parent a904da2 commit 54f18c5

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

_test/pagemove.test.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,5 +596,21 @@ function test_move_ns_in_same_ns() {
596596

597597
}
598598

599+
function test_move_start_ns_into_ns_page() {
600+
saveWikiText('bugs:start', 'Bug page', 'created');
601+
idx_addPage('bugs:start');
602+
saveWikiText('foo:bugs:test', '[[bugs:start]]', 'created');
603+
idx_addPage('foo:bugs:test');
604+
605+
/** @var helper_plugin_move_op $move */
606+
$move = plugin_load('helper', 'move_op');
607+
608+
$this->assertTrue($move->movePage('bugs:start', 'bugs'));
609+
$this->assertEquals('[[:bugs]]', rawWiki('foo:bugs:test'));
610+
611+
$this->assertTrue($move->movePage('bugs', 'start'));
612+
$this->assertEquals('[[:start]]', rawWiki('foo:bugs:test'));
613+
}
614+
599615
}
600616

helper/handler.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ public function relativeLink($relold, $new, $type) {
160160

161161
// if it wasn't relative then, leave it absolute now, too
162162
if(!$wasrel) {
163+
if($this->ns && !getNS($new)) $new = ':' . $new;
163164
$new = $this->_nsStartCheck($relold, $new, $type);
164165
return $new;
165166
}

0 commit comments

Comments
 (0)