chore: Introduce a new class WebAppURL that extends URL (#14982)

* chore: Introduce a new class WebAppURL that extends URL

* update

---------

Co-authored-by: Peer Richelsen <[email protected]>
This commit is contained in:
Anik Dhabal BabuandPeer Richelsen authored and GitHub committed 2024-07-18 07:27:34 +00:00
1 parent 22fc47f69f
commit 2ad3592eb3
3 files changed
+12 -4

No files matched your search

+2 -2
View File
@@ -1,6 +1,6 @@
import type { GetServerSideProps, GetServerSidePropsContext, GetServerSidePropsResult } from "next";
import { WEBAPP_URL } from "@calcom/lib/constants";
import { WebAppURL } from "@calcom/lib/WebAppURL";
export type EmbedProps = {
isEmbed?: boolean;
@@ -17,7 +17,7 @@ export default function withEmbedSsr(getServerSideProps: GetServerSideProps) {
let urlPrefix = "";
// Get the URL parsed from URL so that we can reliably read pathname and searchParams from it.
const destinationUrlObj = new URL(ssrResponse.redirect.destination, WEBAPP_URL);
const destinationUrlObj = new WebAppURL(ssrResponse.redirect.destination);
// If it's a complete URL, use the origin as the prefix to ensure we redirect to the same domain.
if (destinationUrl.search(/^(http:|https:).*/) !== -1) {