Permalink
Browse files

followup fix to bugs from #298

  • Loading branch information...
mikemorris committed Mar 27, 2013
1 parent 330a251 commit 16740e6b5f22f0d039311be3e0d37d8bf175fd08
Showing with 8 additions and 2 deletions.
  1. +8 −2 _includes/model.js
View
@@ -161,10 +161,16 @@ function loadBranches(user, repo, cb) {
// -------
function getFiles(tree, path, searchstr) {
+ console.log(path);
var pathMatches = 0;
function matchesPath(file) {
if (file.path === path) return false; // skip current path
- var match = file.path.match(new RegExp("^"+path+"/(.*)$"));
+ var length = path.length;
+ // Append trailing slash if path exists and not already present
+ if (length && path[length - 1] !== '/') {
+ path += '/';
+ }
+ var match = file.path.match(new RegExp("^"+path+"(.*)$"));
if (match) {
return !!searchstr || match[1].split('/').length <= (path ? 2 : 1);
}
@@ -189,7 +195,7 @@ function getFiles(tree, path, searchstr) {
// Mark match if searchstr not empty
if (searchstr.length) {
- file.name = file.name.replace(matchSearch, "<b>$1</b>");
+ file.name = file.name.replace(matchSearch, "<strong>$1</strong>");
}
if (!matchesPath(file)) return false;

0 comments on commit 16740e6

Please sign in to comment.