diff --git a/src/IDF/Tests/TestSource.php b/src/IDF/Tests/TestSource.php index 77e5977..fbe95da 100644 --- a/src/IDF/Tests/TestSource.php +++ b/src/IDF/Tests/TestSource.php @@ -44,4 +44,21 @@ class IDF_Tests_TestSource extends UnitTestCase $this->assertEqual($mime, $m[0]); } } + + public function testRegexCommit() + { + $regex = '#^/p/([\-\w]+)/source/tree/([^\/]+)/(.*)$#'; + $tests = array('/p/test_project/source/tree/default/current/sources' => + array('test_project', 'default', 'current/sources'), + '/p/test_project/source/tree/3.6/current/sources' => + array('test_project', '3.6', 'current/sources'), + ); + foreach ($tests as $test => $res) { + $m = array(); + $t = preg_match($regex, $test, $m); + $this->assertEqual($res[0], $m[1]); + $this->assertEqual($res[1], $m[2]); + $this->assertEqual($res[2], $m[3]); + } + } } \ No newline at end of file diff --git a/src/IDF/conf/urls.php b/src/IDF/conf/urls.php index bf91384..aaf890d 100644 --- a/src/IDF/conf/urls.php +++ b/src/IDF/conf/urls.php @@ -147,37 +147,37 @@ $ctl[] = array('regex' => '#^/p/([\-\w]+)/issues/attachment/(\d+)/(.*)$#', // ---------- SCM ---------------------------------------- -$ctl[] = array('regex' => '#^/p/([\-\w]+)/source/tree/([\S^/]+)/$#', +$ctl[] = array('regex' => '#^/p/([\-\w]+)/source/tree/([^/]+)/$#', 'base' => $base, 'priority' => 4, 'model' => 'IDF_Views_Source', 'method' => 'treeBase'); -$ctl[] = array('regex' => '#^/p/([\-\w]+)/source/tree/([\S^/]+)/(.*)$#', +$ctl[] = array('regex' => '#^/p/([\-\w]+)/source/tree/([^/]+)/(.*)$#', 'base' => $base, 'priority' => 4, 'model' => 'IDF_Views_Source', 'method' => 'tree'); -$ctl[] = array('regex' => '#^/p/([\-\w]+)/source/changes/([\S^/]+)/$#', +$ctl[] = array('regex' => '#^/p/([\-\w]+)/source/changes/([^/]+)/$#', 'base' => $base, 'priority' => 4, 'model' => 'IDF_Views_Source', 'method' => 'changeLog'); -$ctl[] = array('regex' => '#^/p/([\-\w]+)/source/commit/([\S^/]+)/$#', +$ctl[] = array('regex' => '#^/p/([\-\w]+)/source/commit/([^/]+)/$#', 'base' => $base, 'priority' => 4, 'model' => 'IDF_Views_Source', 'method' => 'commit'); -$ctl[] = array('regex' => '#^/p/([\-\w]+)/source/download/([\S^/]+)/$#', +$ctl[] = array('regex' => '#^/p/([\-\w]+)/source/download/([^/]+)/$#', 'base' => $base, 'priority' => 4, 'model' => 'IDF_Views_Source', 'method' => 'download'); -$ctl[] = array('regex' => '#^/p/([\-\w]+)/source/file/([\S^/]+)/(.*)$#', +$ctl[] = array('regex' => '#^/p/([\-\w]+)/source/file/([^/]+)/(.*)$#', 'base' => $base, 'priority' => 4, 'model' => 'IDF_Views_Source',