Skip to content

Commit 1419278

Browse files
committed
redirect to file contents
1 parent 1eae2f0 commit 1419278

File tree

1 file changed

+5
-4
lines changed
  • packages/web/src/app/api/[chainId]/files/[filename]/download

1 file changed

+5
-4
lines changed

packages/web/src/app/api/[chainId]/files/[filename]/download/route.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ export async function GET(
1313

1414
if (!file) return new Response(null, { status: 404 });
1515

16-
return new Response(file.contents, {
16+
return new Response(null, {
17+
status: 302,
1718
headers: {
18-
"Content-Disposition": `attachment; filename=${encodeURIComponent(file.filename)}`,
19-
...(file.type ? { "Content-Type": file.type } : null),
20-
...(file.encoding ? { "Content-Encoding": file.encoding } : null),
19+
Location: `data:${file.type}${
20+
file.encoding === "base64" ? ";base64" : ""
21+
},${file.contents}`,
2122
},
2223
});
2324
}

0 commit comments

Comments
 (0)