diff --git a/packages/web/components/Drawer/CreateItemModal.tsx b/packages/web/components/Drawer/CreateItemModal.tsx index 371327d..570c5e9 100644 --- a/packages/web/components/Drawer/CreateItemModal.tsx +++ b/packages/web/components/Drawer/CreateItemModal.tsx @@ -8,6 +8,7 @@ import { useRecoilValue } from "recoil"; import { useAuth } from "../../contexts/authContext"; import { selectedConvoAtom } from "../../recoil/main"; import LinkIcon, { getFavicon } from "./LinkIcon"; +import isValidHttpUrl from "@nirvana/common/helpers/urlHelper"; export default function CreateItemModal(props: { pastedLink: string; @@ -54,6 +55,12 @@ export default function CreateItemModal(props: { return; } + if (!isValidHttpUrl(linkVal)) { + toast.error("not a valid url"); + setLoading(false); + return; + } + // service to add link to the collection // change the cacheddraweritem on the convo doc const newLink = new Link(linkDesc, linkVal, currUser!.uid);