fix: video size error handling — validation, timeouts, failure surfacing
Backend: - Increase ffmpeg/ffprobe timeouts from 15s to 60s for large videos - Classify processing errors (timeout, OOM, corrupt) with user-facing messages - Emit failure details via media:job:update socket event (error field) - Bump refboard container memory 512M → 1G Frontend: - Client-side file size validation (200MB) before upload starts - Oversized files show immediate error in upload manager, skip upload - Handle media:job:update status='failed' — surface error in upload panel - Add processingFailed() to UploadManager for video processing errors
This commit is contained in:
@@ -7,6 +7,10 @@ import { uploadImage, uploadImageFromUrl } from '../api';
|
||||
|
||||
type OnChange = () => void;
|
||||
|
||||
/** Client-side file size limit (matches backend MAX_FILE_SIZE_MB default) */
|
||||
const MAX_FILE_SIZE_MB = 200;
|
||||
const MAX_FILE_SIZE = MAX_FILE_SIZE_MB * 1024 * 1024;
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* Placeholder helper */
|
||||
/* ------------------------------------------------------------------ */
|
||||
@@ -153,6 +157,15 @@ export function setupDragDrop(
|
||||
let cursorX = world.x;
|
||||
for (let c = 0; c < col; c++) cursorX += (colWidths[c] || 220) + GAP;
|
||||
|
||||
// Client-side size validation
|
||||
if (file.size > MAX_FILE_SIZE) {
|
||||
const jobId = uploads?.addJob(file, boardId);
|
||||
if (jobId) uploads?.setFailed(jobId, `File too large (${(file.size / 1024 / 1024).toFixed(0)}MB, max ${MAX_FILE_SIZE_MB}MB)`);
|
||||
col++;
|
||||
if (col >= cols) { col = 0; row++; cursorY += rowMaxH + GAP; rowMaxH = 0; }
|
||||
continue;
|
||||
}
|
||||
|
||||
const placeholder = createPlaceholder(viewport, cursorX, cursorY);
|
||||
const jobId = uploads?.addJob(file, boardId);
|
||||
|
||||
@@ -241,6 +254,13 @@ export function setupPaste(
|
||||
const file = item.getAsFile();
|
||||
if (!file) continue;
|
||||
|
||||
// Client-side size validation
|
||||
if (file.size > MAX_FILE_SIZE) {
|
||||
const jobId = uploads?.addJob(file, boardId);
|
||||
if (jobId) uploads?.setFailed(jobId, `File too large (${(file.size / 1024 / 1024).toFixed(0)}MB, max ${MAX_FILE_SIZE_MB}MB)`);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Place at viewport center (world coords)
|
||||
const center = viewport.center;
|
||||
const cx = center.x;
|
||||
|
||||
Reference in New Issue
Block a user