From f847e1c6c60cd6fff0337188c56fe08312819342 Mon Sep 17 00:00:00 2001 From: Cuishibing <643237029@qq.com> Date: Sun, 26 Apr 2026 21:50:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=A2=84=E8=A7=88URL=E6=B7=BB=E5=8A=A0A?= =?UTF-8?q?PI=20key=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/upload/route.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/api/upload/route.ts b/app/api/upload/route.ts index 8ada232..ea9aab0 100644 --- a/app/api/upload/route.ts +++ b/app/api/upload/route.ts @@ -24,7 +24,6 @@ export async function POST(request: NextRequest) { const buffer = await file.arrayBuffer(); imageBuffer = Buffer.from(buffer); - // 压缩图片 const image = sharp(imageBuffer); const metadata = await image.metadata(); @@ -56,7 +55,6 @@ export async function POST(request: NextRequest) { .toBuffer() as any; } - // 上传到 my_oss const formData2 = new FormData(); const uint8Array = new Uint8Array(imageBuffer); const blob = new Blob([uint8Array], { type: 'image/jpeg' }); @@ -78,8 +76,7 @@ export async function POST(request: NextRequest) { const fileData = await uploadRes.json(); - // 返回 my_oss 的访问URL - const url = `${OSS_URL}/api/files/${fileData.fileKey}/preview`; + const url = `${OSS_URL}/api/files/${fileData.fileKey}/preview?key=${API_KEY}`; return NextResponse.json({ url, fileKey: fileData.fileKey }); } catch (error) { console.error('Upload error:', error);