refactor: update MITM bypass logic and enhance combo name validation
This commit is contained in:
1 parent
a0500dfc85
commit
f1c53a319e
6 files changed
+54
-62
No files matched your search
@@ -2,7 +2,7 @@ import { NextResponse } from "next/server";
|
||||
import { getComboById, updateCombo, deleteCombo, getComboByName } from "@/lib/localDb";
|
||||
|
||||
// Validate combo name: only a-z, A-Z, 0-9, -, _
|
||||
const VALID_NAME_REGEX = /^[a-zA-Z0-9_-]+$/;
|
||||
const VALID_NAME_REGEX = /^[a-zA-Z0-9_.\-]+$/;
|
||||
|
||||
// GET /api/combos/[id] - Get combo by ID
|
||||
export async function GET(request, { params }) {
|
||||
@@ -30,7 +30,7 @@ export async function PUT(request, { params }) {
|
||||
// Validate name format if provided
|
||||
if (body.name) {
|
||||
if (!VALID_NAME_REGEX.test(body.name)) {
|
||||
return NextResponse.json({ error: "Name can only contain letters, numbers, - and _" }, { status: 400 });
|
||||
return NextResponse.json({ error: "Name can only contain letters, numbers, -, _ and ." }, { status: 400 });
|
||||
}
|
||||
|
||||
// Check if name already exists (exclude current combo)
|
||||
|
||||
Reference in new issue
Block a user