Skip to content

Commit

Permalink
When filtering for file extensions, match e.g. ".can" with ".canvas"
Browse files Browse the repository at this point in the history
  • Loading branch information
scambier committed Feb 24, 2023
1 parent d6b4d65 commit 1799b8f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/search/omnisearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,11 @@ export class Omnisearch {

// Filter query results to only keep files that match query.extensions (if any)
if (query.extensions.length) {
results = results.filter(r =>
query.extensions.some(e => r.id.endsWith(e))
)
results = results.filter(r => {
// ".can" should match ".canvas"
const ext = '.' + r.id.split('.').pop()
return query.extensions.some(e => ext.startsWith(e))
})
}

// If the query does not return any result,
Expand Down

0 comments on commit 1799b8f

Please sign in to comment.