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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user