Add escapeHtmlProperty on url params

This commit is contained in:
Rafael 2022-01-31 15:29:43 -03:00 committed by Thomas Zarebczan
parent 1628d4901c
commit 3d4a4cd960

View file

@ -13,16 +13,16 @@ function generateEmbedUrl(claimName, claimId, startTime, referralLink) {
let urlParams = new URLSearchParams();
if (startTime) {
urlParams.append('t', startTime);
urlParams.append('t', escapeHtmlProperty(startTime));
}
if (referralLink) {
urlParams.append('r', referralLink);
urlParams.append('r', escapeHtmlProperty(referralLink));
}
const encodedUriName = encodeURIComponent(claimName).replace(/'/g, '%27').replace(/\(/g, '%28').replace(/\)/g, '%29');
const embedUrl = `${URL}/$/embed/${encodedUriName}/${claimId}`;
const embedUrl = `${URL}/$/embed/${escapeHtmlProperty(encodedUriName)}/${escapeHtmlProperty(claimId)}`;
const embedUrlParams = urlParams.toString() ? `?${urlParams.toString()}` : '';
return `${embedUrl}${embedUrlParams}`;