From 9083219ccc15c42cc878aabc894bbb9cc6b58812 Mon Sep 17 00:00:00 2001 From: Vordgi Date: Mon, 2 Mar 2026 15:30:32 +0000 Subject: [PATCH] fix: improve validation and submitting on profile page --- app/pages/profile/[identity]/index.vue | 12 ++++-------- server/api/social/profile/[identifier]/index.put.ts | 7 ++++++- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/app/pages/profile/[identity]/index.vue b/app/pages/profile/[identity]/index.vue index 614191fe06..45c9c0f577 100644 --- a/app/pages/profile/[identity]/index.vue +++ b/app/pages/profile/[identity]/index.vue @@ -112,7 +112,7 @@ defineOgImageComponent('Default', {
-
+
+
diff --git a/server/api/social/profile/[identifier]/index.put.ts b/server/api/social/profile/[identifier]/index.put.ts index a93e196ac3..f71e234d8b 100644 --- a/server/api/social/profile/[identifier]/index.put.ts +++ b/server/api/social/profile/[identifier]/index.put.ts @@ -13,7 +13,12 @@ export default eventHandlerWithOAuthSession(async (event, oAuthSession) => { await throwOnMissingOAuthScope(oAuthSession, PROFILE_SCOPE) - const body = parse(ProfileEditBodySchema, await readBody(event)) + const requestBody = await readBody(event) + if (requestBody.website && !URL.canParse(requestBody.website)) { + throw createError({ statusCode: 400, statusMessage: 'Invalid website' }) + } + + const body = parse(ProfileEditBodySchema, requestBody) const client = new Client(oAuthSession) const profile = dev.npmx.actor.profile.$build({