Fixed the regex to match the commit and the path.
This commit is contained in:
		@@ -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]);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -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',
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user