refactor: update accepted file types for CSV uploads in import form and schema

This commit is contained in:
2025-11-13 13:14:52 +01:00
parent bcbac2998c
commit 4650be830b
2 changed files with 8 additions and 4 deletions
@@ -69,7 +69,7 @@ export default function ImportForm({
</label> </label>
<input <input
type="file" type="file"
accept=".csv" accept="text/csv, text/comma-separated-values"
onChange={handleFileChange} onChange={handleFileChange}
className="w-full rounded-lg border px-4 py-2" className="w-full rounded-lg border px-4 py-2"
/> />
+7 -3
View File
@@ -1,9 +1,13 @@
import { z } from "zod" import { z } from "zod"
const ACCEPTED_MIME_TYPES = ["text/csv", "text/comma-separated-values"]
export const importSchema = z.object({ export const importSchema = z.object({
file: z.instanceof(File).refine((file) => file.type === "text/csv", { file: z
message: "File must be a CSV", .instanceof(File)
}), .refine((file) => ACCEPTED_MIME_TYPES.includes(file.type), {
message: "File must be a CSV",
}),
categoryId: z.string().optional(), categoryId: z.string().optional(),
}) })