unrewriteBlob parity

This commit is contained in:
velzie 2024-10-12 15:16:16 -04:00
parent dc0a2c6d12
commit 3100d07609
3 changed files with 22 additions and 8 deletions

View file

@ -5,6 +5,7 @@ import { URLMeta, rewriteUrl } from "./url";
import { rewriteCss } from "./css";
import { rewriteJs } from "./js";
import { CookieStore } from "../cookie";
import { unrewriteBlob } from "../../shared";
export function rewriteHtml(
html: string,
@ -120,8 +121,6 @@ export const htmlRules: {
"image",
"iframe",
"source",
"video",
"audio",
"input",
"track",
],
@ -132,6 +131,17 @@ export const htmlRules: {
poster: ["video"],
"xlink:href": ["image"],
},
{
fn: (value: string, meta: URLMeta) => {
if (value.startsWith("blob:")) {
// for media elements specifically they must take the original blob
// because they can't be fetch'd
return unrewriteBlob(value);
}
return rewriteUrl(value, meta);
},
src: ["video", "audio"],
},
{
fn: () => null,