Skip to content

Commit

Permalink
Perform Unicode normalization before sanitizing string
Browse files Browse the repository at this point in the history
  • Loading branch information
tlipkis committed Jul 16, 2023
1 parent 39c8e14 commit a4c3117
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/org/lockss/servlet/AddContentTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -565,8 +565,7 @@ private static void addTitleRow(Table table, String key, String value) {
* @return Returns sanitised string
*/
public static String cleanName(String name) {
return Normalizer.normalize(HtmlUtil.encode(name.replace(" ", "_").replace("&", "").replace("(", "")
.replace(")", "").replace(",", "").replace("+", "_"), HtmlUtil.ENCODE_TEXT), Normalizer.Form.NFC);
return DisplayContentTab.cleanName(name);
}

public static String cleanAuName(String auName) {
Expand Down
3 changes: 3 additions & 0 deletions src/org/lockss/servlet/DisplayContentTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,9 @@ public static Image checkHasContent(SubstanceChecker.State substanceState) {
* @param name
* @return Returns sanitised string
*/
// XXX Should move to utility class, but we have several
// sanitize/clean methods in use in different places so need to
// rationalize them and come up with a meaningful naming scheme.
public static String cleanName(String name) {
return HtmlUtil.encode(Normalizer.normalize(name, Normalizer.Form.NFC)
.replace(" ", "_")
Expand Down

0 comments on commit a4c3117

Please sign in to comment.