mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-30 10:27:49 +00:00
fix: video not rendering — add TipTap Video extension, allow HTTP src
TipTap didn't recognize <video> tags without a custom node extension, serializing them as escaped text. Also revert video src to allow HTTP since request.base_url returns http:// behind reverse proxy.
This commit is contained in:
@@ -189,13 +189,14 @@ function sanitizeHtml(html: string): string {
|
||||
}
|
||||
});
|
||||
|
||||
// Hook: validate <video> src — HTTPS only
|
||||
// Hook: validate <video> src — only allow http/https (block javascript:, data:, etc.)
|
||||
// HTTP is permitted because request.base_url behind a reverse proxy returns http://
|
||||
DOMPurify.addHook('afterSanitizeAttributes', (node) => {
|
||||
if (node.tagName === 'VIDEO') {
|
||||
const src = node.getAttribute('src') ?? '';
|
||||
try {
|
||||
const url = new URL(src);
|
||||
if (url.protocol !== 'https:') {
|
||||
if (url.protocol !== 'https:' && url.protocol !== 'http:') {
|
||||
node.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user