fix: parse embeddable srcdoc urls strictly (#7884)

This commit is contained in:
David Luzar 2024-04-12 20:51:17 +02:00 committed by GitHub
parent 4689a6b300
commit afcde542f9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 26 additions and 10 deletions

View file

@ -1,11 +1,15 @@
import { sanitizeUrl } from "@braintree/sanitize-url";
export const sanitizeHTMLAttribute = (html: string) => {
return html.replace(/"/g, """);
};
export const normalizeLink = (link: string) => {
link = link.trim();
if (!link) {
return link;
}
return sanitizeUrl(link);
return sanitizeUrl(sanitizeHTMLAttribute(link));
};
export const isLocalLink = (link: string | null) => {