mirror of
https://github.com/ItsVipra/ProToots
synced 2024-11-21 19:13:03 +00:00
add html decoding to pronoun sanitation
This commit is contained in:
parent
42b954f209
commit
bd14d190a2
1 changed files with 5 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
|||
import sanitizeHtml from "sanitize-html";
|
||||
import { htmlDecode } from "./domhelpers.js";
|
||||
|
||||
const fieldMatchers = [/\bpro.*nouns?\b/i, /\bpronomen\b/i, /(i )?go(es)? by/i];
|
||||
const knownPronounUrls = [
|
||||
|
@ -179,9 +180,12 @@ function sanitizePronouns(str) {
|
|||
// Remove trailing characters that are used as separators.
|
||||
str = str.replace(/[-| :/]+$/, "");
|
||||
|
||||
// Finally, remove leading and trailing whitespace.
|
||||
// Remove leading and trailing whitespace.
|
||||
str = str.trim();
|
||||
|
||||
//Finally, turn escaped characters (e.g. &,>) back into their original form
|
||||
str = htmlDecode(str);
|
||||
|
||||
// If the result is empty, return null, otherwise the empty string.
|
||||
return str === "" ? null : str;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue