Permalink
Browse files

Merge pull request #300 from prose/filepath

followup fix to bugs from #298
  • Loading branch information...
2 parents 330a251 + 01e70f6 commit ec186f99e4387be5a4868469c92429a976c0521c @mikemorris mikemorris committed Mar 27, 2013
Showing with 7 additions and 2 deletions.
  1. +7 −2 _includes/model.js
View
@@ -164,7 +164,12 @@ function getFiles(tree, path, searchstr) {
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 +194,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 ec186f9

Please sign in to comment.