|
|
@ -72,6 +72,10 @@ export function filterRepoFilesWeighted(files, filter) { |
|
|
|
return filterResult; |
|
|
|
return filterResult; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function escapePath(s) { |
|
|
|
|
|
|
|
return s.split('/').map(encodeURIComponent).join('/'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function filterRepoFiles(filter) { |
|
|
|
function filterRepoFiles(filter) { |
|
|
|
const treeLink = $repoFindFileInput.attr('data-url-tree-link'); |
|
|
|
const treeLink = $repoFindFileInput.attr('data-url-tree-link'); |
|
|
|
$repoFindFileTableBody.empty(); |
|
|
|
$repoFindFileTableBody.empty(); |
|
|
@ -83,7 +87,7 @@ function filterRepoFiles(filter) { |
|
|
|
for (const r of filterResult) { |
|
|
|
for (const r of filterResult) { |
|
|
|
const $row = $(tmplRow); |
|
|
|
const $row = $(tmplRow); |
|
|
|
const $a = $row.find('a'); |
|
|
|
const $a = $row.find('a'); |
|
|
|
$a.attr('href', `${treeLink}/${r.matchResult.join('')}`); |
|
|
|
$a.attr('href', `${treeLink}/${escapePath(r.matchResult.join(''))}`); |
|
|
|
const $octiconFile = $(svg('octicon-file')).addClass('mr-3'); |
|
|
|
const $octiconFile = $(svg('octicon-file')).addClass('mr-3'); |
|
|
|
$a.append($octiconFile); |
|
|
|
$a.append($octiconFile); |
|
|
|
// if the target file path is "abc/xyz", to search "bx", then the matchResult is ['a', 'b', 'c/', 'x', 'yz']
|
|
|
|
// if the target file path is "abc/xyz", to search "bx", then the matchResult is ['a', 'b', 'c/', 'x', 'yz']
|
|
|
|