Add PDF type validation to file picker upload

The drop handler validated PDF type but the file picker did not,
allowing non-PDF files to bypass client-side validation.
This commit is contained in:
Pier-Jean Malandrino 2026-04-03 13:03:48 +02:00
parent 8856daf3c9
commit 87269b9393

View file

@ -42,7 +42,10 @@ function openFilePicker() {
async function onFileSelect(e: Event) {
const target = e.target as HTMLInputElement
const file = target.files?.[0]
if (file) {
if (
file &&
(file.type === 'application/pdf' || file.name.toLowerCase().endsWith('.pdf'))
) {
try {
store.clearError()
const doc = await store.upload(file)