Allowing & and = in links

This commit is contained in:
Knut Sveidqvist
2021-10-14 21:08:42 +02:00
parent 4a50995906
commit ebe8b8d89f
4 changed files with 71 additions and 0 deletions

View File

@@ -221,6 +221,8 @@ export const addLinks = function (actorId, text) {
// JSON.parse the text
try {
let sanitizedText = sanitizeText(text.text, configApi.getConfig());
sanitizedText = sanitizedText.replace(/&/g, '&');
sanitizedText = sanitizedText.replace(/=/g, '=');
const links = JSON.parse(sanitizedText);
// add the deserialized text to the actor's links field.
insertLinks(actor, links);
@@ -236,6 +238,8 @@ export const addALink = function (actorId, text) {
const links = {};
let sanitizedText = sanitizeText(text.text, configApi.getConfig());
var sep = sanitizedText.indexOf('@');
sanitizedText = sanitizedText.replace(/&/g, '&');
sanitizedText = sanitizedText.replace(/=/g, '=');
var label = sanitizedText.slice(0, sep - 1).trim();
var link = sanitizedText.slice(sep + 1).trim();