From 62162c6c2a1a17e08a660dad4faed55e7815a95f Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Fri, 20 May 2022 15:37:39 -0700 Subject: [PATCH] =?UTF-8?q?fix(viewer):=20=F0=9F=90=9B=20Ignoring=20port?= =?UTF-8?q?=20number=20when=20checking=20matching=20URL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/viewer/pages/[[...publicId]].tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/viewer/pages/[[...publicId]].tsx b/apps/viewer/pages/[[...publicId]].tsx index d0383f960..a4c11c947 100644 --- a/apps/viewer/pages/[[...publicId]].tsx +++ b/apps/viewer/pages/[[...publicId]].tsx @@ -15,7 +15,9 @@ export const getServerSideProps: GetServerSideProps = async ( if (!context.req.headers.host) return { props: {} } const viewerUrls = (process.env.NEXT_PUBLIC_VIEWER_URL ?? '').split(',') const isMatchingViewerUrl = viewerUrls.some((url) => - context.req.headers.host?.includes(url.split('//')[1]) + (context.req.headers.host ?? '') + .split(':')[0] + .includes(url.split('//')[1].split(':')[0]) ) const customDomain = `${context.req.headers.host}${ pathname === '/' ? '' : pathname @@ -27,7 +29,7 @@ export const getServerSideProps: GetServerSideProps = async ( console.log( isMatchingViewerUrl ? `Couldn't find publicId: ${context.query.publicId?.toString()}` - : `Couldn't customDomain: ${customDomain}` + : `Couldn't find customDomain: ${customDomain}` ) return { props: {