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>
<input
type="file"
accept=".csv"
accept="text/csv, text/comma-separated-values"
onChange={handleFileChange}
className="w-full rounded-lg border px-4 py-2"
/>
+5 -1
View File
@@ -1,7 +1,11 @@
import { z } from "zod"
const ACCEPTED_MIME_TYPES = ["text/csv", "text/comma-separated-values"]
export const importSchema = z.object({
file: z.instanceof(File).refine((file) => file.type === "text/csv", {
file: z
.instanceof(File)
.refine((file) => ACCEPTED_MIME_TYPES.includes(file.type), {
message: "File must be a CSV",
}),
categoryId: z.string().optional(),