From c93c634a779625af74fda5b588177a066088ddb2 Mon Sep 17 00:00:00 2001 From: Aslam Date: Sat, 12 Oct 2024 05:03:01 +0700 Subject: [PATCH] Update -link-form.tsx --- .../routes/_layout/_pages/_protected/links/-link-form.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web/app/routes/_layout/_pages/_protected/links/-link-form.tsx b/web/app/routes/_layout/_pages/_protected/links/-link-form.tsx index 5e54be51..28546103 100644 --- a/web/app/routes/_layout/_pages/_protected/links/-link-form.tsx +++ b/web/app/routes/_layout/_pages/_protected/links/-link-form.tsx @@ -50,14 +50,15 @@ export const getMetadata = createServerFn("GET", async (url: string) => { }) } - const result = urlSchema.safeParse(url) + const result = urlSchema.safeParse(decodeURIComponent(url)) + if (!result.success) { throw new Error( result.error.issues.map((issue) => issue.message).join(", "), ) } - url = ensureUrlProtocol(url) + url = ensureUrlProtocol(decodeURIComponent(url)) try { const response = await fetch(url, {