From a325b390d13049ff13b6e914d8d659b4cc05356f Mon Sep 17 00:00:00 2001 From: Mikkel RINGAUD Date: Fri, 11 Aug 2023 18:09:42 +0200 Subject: [PATCH] fix: use native `Response.redirect` for file redirection --- src/routes/api/file/[upload_id].ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/routes/api/file/[upload_id].ts b/src/routes/api/file/[upload_id].ts index 550f9cd..531beaa 100644 --- a/src/routes/api/file/[upload_id].ts +++ b/src/routes/api/file/[upload_id].ts @@ -1,4 +1,5 @@ -import { type APIEvent, json, redirect } from "solid-start" +import { type APIEvent, json } from "solid-start"; + import { supabase, getUserProfile } from "@/supabase/server"; import { UploadedFile, UserProfile } from "@/types/api"; @@ -61,7 +62,7 @@ export const GET = async ({ request, params }: APIEvent): Promise => { .from("uploads") .createSignedUrl(`${file_data.creator ?? "anon"}/${file_data.id}.${file_extension}`, 3600); - return redirect(data!.signedUrl); + return Response.redirect(data!.signedUrl, 301); } catch (error) { console.error(error);