mirror of
https://github.com/trafficlunar/tomodachi-share.git
synced 2026-06-28 14:44:15 +00:00
fix: qr code size validation
This commit is contained in:
parent
ed33993a42
commit
75e2444541
3 changed files with 10 additions and 4 deletions
|
|
@ -8,7 +8,7 @@ import qrcode from "qrcode-generator";
|
|||
|
||||
import { auth } from "@/lib/auth";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
import { MII_DECRYPTION_KEY, MII_QR_SIZES } from "@/lib/constants";
|
||||
import { MII_DECRYPTION_KEY } from "@/lib/constants";
|
||||
import { nameSchema, tagsSchema } from "@/lib/schemas";
|
||||
|
||||
const uploadsDirectory = path.join(process.cwd(), "public", "uploads");
|
||||
|
|
@ -28,7 +28,7 @@ export async function POST(request: Request) {
|
|||
if (!tagsValidation.success) return Response.json({ error: tagsValidation.error.errors[0].message }, { status: 400 });
|
||||
|
||||
// Validate QR code size
|
||||
if (!MII_QR_SIZES.includes(qrBytesRaw.length)) return Response.json({ error: "QR code is not a valid Mii QR code size" }, { status: 400 });
|
||||
if (qrBytesRaw.length !== 372) return Response.json({ error: "QR code size is not a valid Tomodachi Life QR code" }, { status: 400 });
|
||||
|
||||
const qrBytes = new Uint8Array(qrBytesRaw);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue