fix: reject unsupported file types with explicit feedback

Replace broad image/*/video/* prefix matching with explicit MIME
allowlist matching backend. Unsupported files (BMP, TIFF, AVIF,
HEIC, PDF, etc.) now show as failed rows in the upload panel
with a clear "Unsupported format: .ext" message instead of being
silently ignored. Applies to both drag-drop and clipboard paste.
This commit is contained in:
Hiren Kangad
2026-03-10 19:44:04 +05:30
parent e45fce3e67
commit 45891a278c
2 changed files with 66 additions and 2 deletions
+17
View File
@@ -67,6 +67,23 @@ export class UploadManager {
return id;
}
/** Create an immediately-failed job (for unsupported file types). */
addRejected(fileName: string, error: string): string {
const id = crypto.randomUUID();
this.jobs.set(id, {
id,
fileName,
fileSize: 0,
mediaType: 'image',
status: 'failed',
progress: 0,
error,
createdAt: Date.now(),
});
this._notify();
return id;
}
/** Update upload progress (0-1). */
setProgress(jobId: string, progress: number) {
const job = this.jobs.get(jobId);