fix: 🐛 redirecting to 404

This commit is contained in:
May 2024-11-20 07:40:49 -08:00
parent 88ec069c55
commit 17814b3478
Signed by: split
GPG key ID: C325C61F0BF517C0

View file

@ -1,10 +1,10 @@
import { getMetadataForIdentifier } from '$lib/avatars.js';
import { error, redirect } from '@sveltejs/kit';
import { getMetadataForIdentifier } from "$lib/avatars.js"
import { error, redirect } from "@sveltejs/kit"
export async function GET({ params : { identifier } }) {
export async function GET({ params: { identifier } }) {
let { source } = await getMetadataForIdentifier(identifier)
let finalUrl: URL | string = `/info/${identifier}`
let finalUrl: URL | string = `/user/${identifier}`
if (source) {
try {
finalUrl = new URL(source)
@ -12,4 +12,4 @@ export async function GET({ params : { identifier } }) {
}
throw redirect(302, finalUrl)
}
}