From 06a06b986c851861ccc86cf08b9d0ed2fdb24bc5 Mon Sep 17 00:00:00 2001 From: Aditya Mitra <55396651+aditya-mitra@users.noreply.github.com> Date: Tue, 25 Jun 2024 14:52:21 +0530 Subject: [PATCH] case insensitive full string search for file browser (#10431) Co-authored-by: Hanzla Mateen --- .../src/media/file-browser/file-browser.class.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/server-core/src/media/file-browser/file-browser.class.ts b/packages/server-core/src/media/file-browser/file-browser.class.ts index 620038b317..79b82f3ca9 100755 --- a/packages/server-core/src/media/file-browser/file-browser.class.ts +++ b/packages/server-core/src/media/file-browser/file-browser.class.ts @@ -114,8 +114,10 @@ export class FileBrowserService let result = await storageProvider.listFolderContent(directory) Object.entries(params.query).forEach(([key, value]) => { if (value['$like']) { - const searchString = value['$like'].replace(/%/g, '') - result = result.filter((item) => item[key].includes(searchString)) + result = result.filter( + (item) => + (item[key] as string).search(new RegExp((value['$like'] as string).replaceAll('%', ''), 'gi')) !== -1 + ) } })