The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
fix isIframeable
Steven Teyc72ade29026e
diff --git a/packages/utils/src/functions/is-iframeable.ts b/packages/utils/src/functions/is-iframeable.tsindex fd2589b5cb..d00fff070a 100644--- a/packages/utils/src/functions/is-iframeable.ts+++ b/packages/utils/src/functions/is-iframeable.ts@@ -9,20 +9,18 @@ export const isIframeable = async ({const res = await fetch(url);const cspHeader = res.headers.get("content-security-policy");- if (!cspHeader) {- return true;- }-- const frameAncestorsMatch = cspHeader.match(- /frame-ancestors\s+([\s\S]+?)(?=;|$)/i,- );- if (frameAncestorsMatch) {- if (frameAncestorsMatch[1] === "*") {- return true;- }- const allowedOrigins = frameAncestorsMatch[1].split(/\s+/);- if (allowedOrigins.includes(requestDomain)) {- return true;+ if (cspHeader) {+ const frameAncestorsMatch = cspHeader.match(+ /frame-ancestors\s+([\s\S]+?)(?=;|$)/i,+ );+ if (frameAncestorsMatch) {+ if (frameAncestorsMatch[1] === "*") {+ return true;+ }+ const allowedOrigins = frameAncestorsMatch[1].split(/\s+/);+ if (allowedOrigins.includes(requestDomain)) {+ return true;+ }}}