From 8b7c19cc3fb2515a2ef8c9e6d34f843c27b47e56 Mon Sep 17 00:00:00 2001 From: Gunjan Datta Date: Tue, 21 Jul 2026 17:58:28 -0400 Subject: [PATCH 1/6] Add for debugging --- spfx/config/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spfx/config/config.json b/spfx/config/config.json index a7d7af3..8934d92 100644 --- a/spfx/config/config.json +++ b/spfx/config/config.json @@ -14,7 +14,7 @@ "externals": { "main-lib": { "globalName": "main-lib", - "path": "../dist/site-admin.min.js" + "path": "../dist/site-admin.js" } }, "localizedResources": { From 0d61668369e220ab3b5c21941dbb9aa974cafdb1 Mon Sep 17 00:00:00 2001 From: Gunjan Datta Date: Tue, 21 Jul 2026 20:09:33 -0400 Subject: [PATCH 2/6] Fixed recursive error. --- src/reports/searchDocs.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/reports/searchDocs.ts b/src/reports/searchDocs.ts index 274368b..da3a4ab 100644 --- a/src/reports/searchDocs.ts +++ b/src/reports/searchDocs.ts @@ -506,10 +506,10 @@ export class SearchDocs { if (item?.data) { // Set the patterns ctrlRegex.setValue((item.data as IRegexPattern).patterns.join(" ")); - } - // Clear the selection - ctrlRegexPatterns.dropdown.setValue(null); + // Clear the selection + ctrlRegexPatterns.dropdown.setValue(null); + } } } as Components.IFormControlPropsDropdown, { From 35b07254696d74bb9a2b45405ba060046617cc3f Mon Sep 17 00:00:00 2001 From: Gunjan Datta Date: Tue, 21 Jul 2026 20:55:44 -0400 Subject: [PATCH 3/6] Updated control to be a note field. --- src/reports/searchDocs.ts | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/src/reports/searchDocs.ts b/src/reports/searchDocs.ts index da3a4ab..8e709da 100644 --- a/src/reports/searchDocs.ts +++ b/src/reports/searchDocs.ts @@ -505,7 +505,7 @@ export class SearchDocs { // See if an item was selected if (item?.data) { // Set the patterns - ctrlRegex.setValue((item.data as IRegexPattern).patterns.join(" ")); + ctrlRegex.setValue((item.data as IRegexPattern).patterns.join("\r\n")); // Clear the selection ctrlRegexPatterns.dropdown.setValue(null); @@ -516,9 +516,10 @@ export class SearchDocs { label: "Regex Patterns", name: "RegexPatterns", className: "mb-3", - description: "Enter the regular expression pattern to search for.", - type: Components.FormControlTypes.TextField, + description: "Enter the regular expression pattern on each line.", + type: Components.FormControlTypes.TextArea, required: true, + rows: 10, errorMessage: "You must enter at least 1 search term.", onControlRendered: ctrl => { ctrlRegex = ctrl; }, onValidate: (ctrl, results) => { @@ -528,11 +529,22 @@ export class SearchDocs { results.isValid = false; results.invalidMessage = "A regex pattern is required."; } else { - // Validate the regex pattern - try { - // Create a new regex - new RegExp(results.value); - } catch (ex) { + let errors = []; + + // Parse the patterns + results.value.split(/\r?\n/).forEach(pattern => { + // Validate the regex pattern + try { + // Create a new regex + new RegExp(results.value); + } catch (ex) { + // Add the error + errors.push(pattern); + } + }); + + // See if errors exist + if (errors.length > 0) { // Invalidate the regex pattern results.isValid = false; results.invalidMessage = "The regex pattern is not valid."; @@ -542,7 +554,7 @@ export class SearchDocs { // Return the results return results; } - }, + } as Components.IFormControlPropsTextField, { label: "Load Permissions", name: "LoadPermissions", @@ -1029,7 +1041,7 @@ export class SearchDocs { // Set the regex patterns let regexPatterns = []; - (values["RegexPatterns"]?.split(' ') || []).forEach(pattern => { + (values["RegexPatterns"]?.split(/\r?\n/) || []).forEach(pattern => { regexPatterns.push(new RegExp(pattern)); }); From e80e7f7f30d78243c2a56b1e922a45abf3696357 Mon Sep 17 00:00:00 2001 From: Gunjan Datta Date: Tue, 21 Jul 2026 20:57:51 -0400 Subject: [PATCH 4/6] Fixed pattern validation. --- src/reports/searchDocs.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/reports/searchDocs.ts b/src/reports/searchDocs.ts index 8e709da..86fdd5e 100644 --- a/src/reports/searchDocs.ts +++ b/src/reports/searchDocs.ts @@ -536,7 +536,7 @@ export class SearchDocs { // Validate the regex pattern try { // Create a new regex - new RegExp(results.value); + new RegExp(pattern); } catch (ex) { // Add the error errors.push(pattern); From 9c4c71b537d3e7a8d23ee58068dad3838b43dfc7 Mon Sep 17 00:00:00 2001 From: Gunjan Datta Date: Tue, 21 Jul 2026 21:04:02 -0400 Subject: [PATCH 5/6] Updated the error message. --- src/reports/searchDocs.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/reports/searchDocs.ts b/src/reports/searchDocs.ts index 86fdd5e..be96235 100644 --- a/src/reports/searchDocs.ts +++ b/src/reports/searchDocs.ts @@ -547,7 +547,7 @@ export class SearchDocs { if (errors.length > 0) { // Invalidate the regex pattern results.isValid = false; - results.invalidMessage = "The regex pattern is not valid."; + results.invalidMessage = "The regex pattern(s) were not valid:
" + errors.join("
"); } } From 82c589c718d2b977dd8c5412151686cd765a60cb Mon Sep 17 00:00:00 2001 From: Gunjan Datta Date: Tue, 21 Jul 2026 21:14:06 -0400 Subject: [PATCH 6/6] Added a safety. --- src/reports/searchDocs.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/reports/searchDocs.ts b/src/reports/searchDocs.ts index be96235..ba999ca 100644 --- a/src/reports/searchDocs.ts +++ b/src/reports/searchDocs.ts @@ -136,9 +136,14 @@ export class SearchDocs { }).catch(reject); break; default: - // Convert the buffer to a string - let decoder = new TextDecoder("utf-8"); - resolve(decoder.decode(buffer)); + try { + // Convert the buffer to a string + let decoder = new TextDecoder("utf-8"); + resolve(decoder.decode(buffer)); + } catch { + // Reject the request + reject("Unable to decode the file content."); + } break; } });