SAK-50813 Site titles with ampersands distorted during publishing #13166
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Jira: https://sakaiproject.atlassian.net/browse/SAK-50813
This proposed fix is preliminary, showing one proposed solution (uncommented) and an alternative (commented out), acknowledging that there may be other approaches.
The first proposed solution (uncommented) is very specific, narrowly focused on fixing the issue with ampersands, which is a common character to be found in site titles (at least for our institution). This approach might valid/good-enough as I cannot think of other HTML meta-characters that are allowable for the Site Title (in Site Info > Edit Site Information); for example, greater than or less than characters are filtered out (when directly entered as is) by the time a revision to the title is to be confirmed (again, via Site Info > Edit Site Information). That said, the approach of this first proposed solution might have overlooked valid characters (which in turn might be resolved with additional StringUtils.replace statements, if there aren't many).
The other approach using convertFormattedTextToPlaintext (commented out) will resolve also the ampersand issue. It may also care for other HTML metacharacters overlooked. This approach however might be deemed too broad.
Once a consensus is reached among reviewers, I can revise this PR to implement the agreed upon approach prior to merging to trunk.