diff --git a/src/shared/rewriters/html.ts b/src/shared/rewriters/html.ts index 8a1760c..2417ef2 100644 --- a/src/shared/rewriters/html.ts +++ b/src/shared/rewriters/html.ts @@ -81,7 +81,8 @@ function traverseParsedHtml(node, origin?: URL) { node.attribs.content.includes("url") ) { const contentArray = node.attribs.content.split("url="); - contentArray[1] = encodeUrl(contentArray[1].trim(), origin); + if (contentArray[1]) + contentArray[1] = encodeUrl(contentArray[1].trim(), origin); node.attribs.content = contentArray.join("url="); } } diff --git a/src/worker/index.ts b/src/worker/index.ts index 5d5a301..97eff42 100644 --- a/src/worker/index.ts +++ b/src/worker/index.ts @@ -70,6 +70,7 @@ self.ScramjetServiceWorker = class ScramjetServiceWorker { let cookieParsed = cookie.split(";").map((x) => x.trim().split("=")); let [key, value] = cookieParsed.shift(); + if (!value) continue; value = value.replace("\"", ""); const hostArg = cookieParsed.find((x) => x[0] === "Domain");