aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/web/components/dashboard/bookmarks/EditorCard.tsx5
1 files changed, 4 insertions, 1 deletions
diff --git a/apps/web/components/dashboard/bookmarks/EditorCard.tsx b/apps/web/components/dashboard/bookmarks/EditorCard.tsx
index 28686e6c..6858255a 100644
--- a/apps/web/components/dashboard/bookmarks/EditorCard.tsx
+++ b/apps/web/components/dashboard/bookmarks/EditorCard.tsx
@@ -67,7 +67,10 @@ export default function EditorCard({ className }: { className?: string }) {
const onSubmit: SubmitHandler<z.infer<typeof formSchema>> = (data) => {
const text = data.text.trim();
try {
- new URL(text);
+ const url = new URL(text);
+ if (url.protocol != "http:" && url.protocol != "https:") {
+ throw new Error("Invalid URL");
+ }
mutate({ type: "link", url: text });
} catch (e) {
// Not a URL