From 74e65ea892b0192fffb7f1f4cd3878c82b8b0f31 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Sun, 19 Apr 2026 13:07:45 -0400 Subject: [PATCH] feat(files): block upload and show warning for legacy .ppt/.doc file formats MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Set file_list_status to 'blocked_legacy' when any selected file is .ppt or .doc, disabling the Upload button until the file is removed - Show a red banner at the top when upload is blocked - Add a per-file warning message row in the file table for all legacy/untrusted extensions (previously computed but never rendered — only a pink cell highlight) - Red styling for blocking extensions (.ppt/.doc), yellow for warn-only Co-Authored-By: Claude Sonnet 4.6 --- .../elements/element_input_files_tbl.svelte | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/lib/elements/element_input_files_tbl.svelte b/src/lib/elements/element_input_files_tbl.svelte index 05400f74..c05155a0 100644 --- a/src/lib/elements/element_input_files_tbl.svelte +++ b/src/lib/elements/element_input_files_tbl.svelte @@ -215,6 +215,10 @@ async function process_file_list(file_list: FileList) { file_data['warning_message'] = warning_message; + // .ppt and .doc must be converted before upload — block, don't just warn + file_data['block_upload'] = + guessed_extension === 'ppt' || guessed_extension === 'doc'; + file_data['uploaded'] = null; file_data['uploaded_bytes'] = null; @@ -272,7 +276,8 @@ async function process_file_list(file_list: FileList) { // input_file_list_processed.push(file_data); } - file_list_status = 'ready'; + const has_blocked = processed_file_list.some((f) => f.block_upload); + file_list_status = has_blocked ? 'blocked_legacy' : 'ready'; console.log(processed_file_list); // return JSON.parse(JSON.stringify(processed_file_list)); @@ -361,6 +366,13 @@ run(() => { {/if} + {#if file_list_status == 'blocked_legacy'} +
+ ⚠ Upload blocked — legacy file format detected. + Please remove the flagged file(s) below and re-save in the modern format before uploading. +
+ {/if} + {#if use_selected_file_table && processed_file_list && processed_file_list.length} @@ -426,6 +438,19 @@ run(() => { })} + {#if file_list_item.warning_message} + + + + {@html file_list_item.warning_message} + + + {/if} {/each}