From 59ebcf9e71076c94fff30fbe5a9c6ef887f7390e Mon Sep 17 00:00:00 2001 From: maxime Date: Mon, 25 Mar 2024 16:32:35 +0100 Subject: [PATCH] remove profile picture link verification --- src/pages/Settings.tsx | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/src/pages/Settings.tsx b/src/pages/Settings.tsx index 140af8f..767caa6 100644 --- a/src/pages/Settings.tsx +++ b/src/pages/Settings.tsx @@ -211,13 +211,6 @@ function ProfileImageInputPopup({ show, onHide }: ProfileImageInputPopupProps) { className={"settings-button"} onClick={async () => { const url = urlRef.current!.value - const exists = await imageExists(url) - setErrorMessages([ - "Le lien ne renvoie vers aucune image !", - ]) - if (!exists) { - return - } const errors = await updateAccount(fetcher, { profilePicture: url, }) @@ -236,18 +229,3 @@ function ProfileImageInputPopup({ show, onHide }: ProfileImageInputPopupProps) { ) } - -async function imageExists(imageLink: string) { - try { - const response = await fetch(imageLink, { mode: "no-cors" }) - - if (response.ok) { - const contentType = response.headers.get("Content-type") - return contentType?.startsWith("image/") ?? false - } - return false - } catch (error) { - console.error(error) - return false - } -}