From 577a7117fdc3c8e42f263cdada86eafe1c959d6f Mon Sep 17 00:00:00 2001 From: David Poindexter Date: Wed, 5 Aug 2020 18:40:55 -0400 Subject: [PATCH 1/2] Fix issue with Item Name dropdown list height --- .../ResourceManager/ResourceManager.Web/app/less/components.less | 1 - 1 file changed, 1 deletion(-) diff --git a/DNN Platform/Modules/ResourceManager/ResourceManager.Web/app/less/components.less b/DNN Platform/Modules/ResourceManager/ResourceManager.Web/app/less/components.less index 71c1a1e1229..2643b6ffdef 100644 --- a/DNN Platform/Modules/ResourceManager/ResourceManager.Web/app/less/components.less +++ b/DNN Platform/Modules/ResourceManager/ResourceManager.Web/app/less/components.less @@ -29,7 +29,6 @@ margin: 0px; list-style: none; box-sizing: border-box; - height: 28px; } } From a09212cbaff6fed9edd320e1e138976d32542691 Mon Sep 17 00:00:00 2001 From: David Poindexter Date: Wed, 5 Aug 2020 19:45:22 -0400 Subject: [PATCH 2/2] Add proper wildcard support --- .../Library/Services/FileSystem/FolderManager.cs | 4 ++-- .../ResourceManager/Components/SearchController.cs | 14 +------------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/DNN Platform/Library/Services/FileSystem/FolderManager.cs b/DNN Platform/Library/Services/FileSystem/FolderManager.cs index ded6cc7c30c..2f6a2b40d43 100644 --- a/DNN Platform/Library/Services/FileSystem/FolderManager.cs +++ b/DNN Platform/Library/Services/FileSystem/FolderManager.cs @@ -1845,11 +1845,11 @@ private static Regex WildcardToRegex(string pattern) { if (!pattern.Contains("*") && !pattern.Contains("?")) { - pattern = "^" + pattern + ".*$"; + pattern = ".*" + Regex.Escape(pattern) + ".*"; } else { - pattern = "^" + Regex.Escape(pattern).Replace(@"\*", ".*").Replace(@"\?", ".") + "$"; + pattern = Regex.Escape(pattern).Replace(@"\*", ".*").Replace(@"\?", "."); } return RegexUtils.GetCachedRegex(pattern, RegexOptions.IgnoreCase); diff --git a/DNN Platform/Modules/ResourceManager/Components/SearchController.cs b/DNN Platform/Modules/ResourceManager/Components/SearchController.cs index 3a66f90ffc6..6fdb222c104 100644 --- a/DNN Platform/Modules/ResourceManager/Components/SearchController.cs +++ b/DNN Platform/Modules/ResourceManager/Components/SearchController.cs @@ -34,11 +34,7 @@ public IList SearchFolderContent(int moduleId, IFolderInfo folder, bo search = (search ?? string.Empty).Trim(); - // Lucene does not support wildcards as the beginning of the search - // For file names we can remove any existing wildcard at the beginning - var cleanedKeywords = TrimStartWildCards(search); - - var files = FolderManager.Instance.SearchFiles(folder, cleanedKeywords, recursive); + var files = FolderManager.Instance.SearchFiles(folder, search, recursive); var sortProperties = SortProperties.Parse(sorting); var sortedFiles = SortFiles(files, sortProperties).ToList(); totalCount = sortedFiles.Count; @@ -46,14 +42,6 @@ public IList SearchFolderContent(int moduleId, IFolderInfo folder, bo return sortedFiles.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList(); } - private static string TrimStartWildCards(string search) - { - var keywords = from keyword in search.Split(' ') - select keyword.TrimStart('*', '?'); - search = string.Join(" ", keywords); - return search; - } - private static IEnumerable SortFiles(IEnumerable files, SortProperties sortProperties) { switch (sortProperties.Column)