When filtering for file extensions, match e.g. ".can" with ".canvas"

This commit is contained in:
Simon Cambier
2023-02-24 22:44:56 +01:00
parent d6b4d65611
commit 1799b8f3f6

View File

@@ -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,