From 1799b8f3f6749d1af63971068170bb7b1a614332 Mon Sep 17 00:00:00 2001 From: Simon Cambier Date: Fri, 24 Feb 2023 22:44:56 +0100 Subject: [PATCH] When filtering for file extensions, match e.g. ".can" with ".canvas" --- src/search/omnisearch.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/search/omnisearch.ts b/src/search/omnisearch.ts index c9a3421..3c97c8e 100644 --- a/src/search/omnisearch.ts +++ b/src/search/omnisearch.ts @@ -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,