Skip to content

FIX: Site crawler regex improvement #7191#7192

Merged
mitchelsellers merged 6 commits into
dnnsoftware:developfrom
johnhenley:issue-search-regex-7191
Apr 8, 2026
Merged

FIX: Site crawler regex improvement #7191#7192
mitchelsellers merged 6 commits into
dnnsoftware:developfrom
johnhenley:issue-search-regex-7191

Conversation

@johnhenley

@johnhenley johnhenley commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

Fixes #7191

Summary

Bug fix and performance improvement for HTML tag processing in the search controller.

This PR enhances the reliability and efficiency of HTML tag stripping and attribute extraction in InternalSearchControllerImpl by improving regex usage and error handling.

  • InternalSearchControllerImpl.cs: Switched to RegexUtils.GetCachedRegex for regex instantiation to enable caching; added timeout parameters
  • InternalSearchControllerImpl.cs: Updated the HTML tag regex for better accuracy and performance
  • InternalSearchControllerImpl.cs: Wrapped all regex operations in StripTagsRetainAttributes with try-catch blocks to handle RegexMatchTimeoutException and log errors, preventing application hangs.

mitchelsellers
mitchelsellers previously approved these changes Apr 7, 2026

@mitchelsellers mitchelsellers left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think t his is a good fix for right nwo with the lower level risk.

@dnnsoftware/approvers I know there was a larger discussion about using HtmlSanitizer for this, but not sure that we want to go to the larger changge here at this time?

Thoughts?

valadas
valadas previously requested changes Apr 8, 2026
Comment thread DNN Platform/Library/Services/Search/Internals/InternalSearchControllerImpl.cs Outdated
@valadas

valadas commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

As for HtmlSanitizer, I think it would be best since we already have it and we don't have to think about all the edge cases that might arise by doing our own regexes IMO... But I won't die on that hill ;)

@bdukes bdukes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Comment thread DNN Platform/Library/Services/Search/Internals/InternalSearchControllerImpl.cs Outdated
Comment thread DNN Platform/Library/Services/Search/Internals/InternalSearchControllerImpl.cs Outdated
Comment thread DNN Platform/Library/Services/Search/Internals/InternalSearchControllerImpl.cs Outdated
Co-authored-by: Brian Dukes <[email protected]>
@johnhenley

Copy link
Copy Markdown
Contributor Author

I made the requested changes.

@johnhenley
johnhenley requested a review from valadas April 8, 2026 17:52
@bdukes bdukes added this to the 10.3.1 milestone Apr 8, 2026

@mitchelsellers mitchelsellers left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates!

@mitchelsellers
mitchelsellers dismissed valadas’s stale review April 8, 2026 19:36

This change was made & we have 2 approvals

@mitchelsellers
mitchelsellers merged commit bcb5f46 into dnnsoftware:develop Apr 8, 2026
7 checks passed
@johnhenley
johnhenley deleted the issue-search-regex-7191 branch April 8, 2026 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Site Search Crawler never completes and uses excessive CPU resources

4 participants