From ce3e19626f6d8c7fdf27104065d52202571e0cfb Mon Sep 17 00:00:00 2001 From: Nikita Karamov Date: Mon, 27 Mar 2023 21:24:58 +0200 Subject: [PATCH] Normalize domain on /api/share --- src/pages/api/share.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/api/share.ts b/src/pages/api/share.ts index 1441371..760fc3a 100644 --- a/src/pages/api/share.ts +++ b/src/pages/api/share.ts @@ -3,6 +3,7 @@ * Licensed under AGPL v3 or later */ +import { getUrlDomain } from "@scripts/util"; import type { APIRoute } from "astro"; export const post: APIRoute = async ({ redirect, request, url }) => { @@ -10,7 +11,7 @@ export const post: APIRoute = async ({ redirect, request, url }) => { const text = (formData.get("text") as string) || ""; const instanceHost = - (formData.get("instance") as string) || "mastodon.social"; + getUrlDomain(formData.get("instance") as string) || "mastodon.social"; try { const response = await fetch(new URL(`/api/detect/${instanceHost}`, url));