fix(files): refine legacy file upload warnings and trusted-access block bypass

- element_input_files_tbl: only block upload for non-trusted users; trusted_access
  users see the same warnings but can still proceed
- element_input_files_tbl: improved warning message wording for .ppt and .doc
- element_manage_event_file_li: minor tweaks

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Scott Idem
2026-04-19 13:56:19 -04:00
parent 74e65ea892
commit 898afd9775
2 changed files with 31 additions and 17 deletions

View File

@@ -175,16 +175,19 @@ async function process_file_list(file_list: FileList) {
warning_legacy_extension = true;
if (guessed_extension == 'ppt') {
warning_message =
'It appears this is a legacy PowerPoint file and has not been officially supported since Office PowerPoint 2003. This file is known to have issues and may not work well. It is <strong>strongly</strong> recommended that this file be saved using the modern PPTX format.';
'<strong>WARNING</strong>: It appears this is a legacy Microsoft PowerPoint file and has not been officially supported since Office PowerPoint <strong>2003</strong>. This file type is known to have issues and may not work well. It is <strong>strongly</strong> recommended that this file be saved using the modern PPTX format in PowerPoint. <a href="https://support.microsoft.com/en-us/office/saving-ppt-to-pptx-or-pptm-e8ebc946-98d1-41bb-bb3e-cf00c65e3a55" class="underline font-semibold text-sm">More Help?</a>';
} else if (guessed_extension == 'doc') {
warning_message =
'<strong>WARNING</strong>: It appears this is a legacy Microsoft Word Document file and has not been officially supported since Office Word <strong>2003</strong>. This file type is known to have issues and may not work well. It is <strong>strongly</strong> recommended that this file be saved using the modern DOCX format in Word. <a href="https://support.microsoft.com/en-us/office/saving-doc-to-docx-or-dorm-0107099d-dc1e-4897-8851-f8c9f483f7cd" class="underline font-semibold text-sm">More Help?</a>';
} else if (guessed_extension == 'avi') {
warning_message =
'It appears this is a video file using the AVI format. It is <strong>strongly</strong> recommended that this file be re-saved as an MP4, MOV, MKV, or MPG/MPEG. The file will also likely be much smaller.';
'<strong>WARNING</strong>: It appears this is a video file using the AVI format. It is <strong>strongly</strong> recommended that this file be re-saved as an MP4, MOV, MKV, or MPG/MPEG. The file will also likely be much smaller.';
} else if (guessed_extension == 'wmv') {
warning_message =
"It appears this is a video file using Microsoft's WMV format. It is <strong>strongly</strong> recommended that this file be re-saved as an MP4, MOV, MKV, or MPG/MPEG.";
"<strong>WARNING</strong>: It appears this is a video file using Microsoft's WMV format. It is <strong>strongly</strong> recommended that this file be re-saved as an MP4, MOV, MKV, or MPG/MPEG.";
} else {
warning_message =
'It appears this is a legacy or not very well supported file format. It is <strong>strongly</strong> recommended that it be saved in an alternative format if possible.';
'<strong>WARNING</strong>: It appears this is a legacy or not very well supported file format. It is <strong>strongly</strong> recommended that it be saved in an alternative format if possible.';
}
} else if (file_size_bytes > 52428800) {
// 50 MB = 52428800 bytes
@@ -217,7 +220,7 @@ async function process_file_list(file_list: FileList) {
// .ppt and .doc must be converted before upload — block, don't just warn
file_data['block_upload'] =
guessed_extension === 'ppt' || guessed_extension === 'doc';
guessed_extension === 'ppt' || guessed_extension === 'doc' || guessed_extension === 'xls';
file_data['uploaded'] = null;
file_data['uploaded_bytes'] = null;
@@ -277,7 +280,7 @@ async function process_file_list(file_list: FileList) {
}
const has_blocked = processed_file_list.some((f) => f.block_upload);
file_list_status = has_blocked ? 'blocked_legacy' : 'ready';
file_list_status = has_blocked && !$ae_loc.trusted_access ? 'blocked_legacy' : 'ready';
console.log(processed_file_list);
// return JSON.parse(JSON.stringify(processed_file_list));
@@ -369,7 +372,7 @@ run(() => {
{#if file_list_status == 'blocked_legacy'}
<div class="m-1 rounded-md border-2 border-red-500 bg-red-100 p-3 text-sm text-red-800 dark:bg-red-900/30 dark:text-red-200">
<strong>⚠ Upload blocked — legacy file format detected.</strong>
Please remove the flagged file(s) below and re-save in the modern format before uploading.
This Microsoft file type has not been supported in more than 10 years. Please remove the flagged file(s) below and re-save in the modern format before uploading.
</div>
{/if}
@@ -380,18 +383,18 @@ run(() => {
<table class="slct_file_list text-sm {table_class_li.join(' ')}">
<thead>
<tr>
<th>Remove</th>
<th>Filename</th>
<th>Modified</th>
<th>Size</th>
<th class="text-xs">Remove</th>
<th class="text-xs">Filename</th>
<th class="text-xs">Modified</th>
<th class="text-xs">Size</th>
<!-- <th>Type</th> -->
<th>Ext</th>
<th>Hash</th>
<th class="text-xs">Ext</th>
<th class="text-xs">Hash</th>
</tr>
</thead>
{#each processed_file_list as file_list_item, file_index (file_index)}
<tbody>
<tr>
<tr class="border">
<td class="file_remove">
<button
onclick={preventDefault(() => {
@@ -441,7 +444,7 @@ run(() => {
{#if file_list_item.warning_message}
<tr>
<td colspan="6"
class="text-left text-xs"
class="text-left text-xs m-1 border border-red-500 p-3"
class:bg-red-100={file_list_item.block_upload}
class:text-red-800={file_list_item.block_upload}
class:bg-yellow-50={!file_list_item.block_upload}

View File

@@ -37,6 +37,7 @@ import {
Laptop,
LoaderCircle,
Monitor,
OctagonAlert,
Pencil,
RefreshCw,
Save,
@@ -715,14 +716,24 @@ async function handle_convert_pdf_to_image(event_file_obj: key_val) {
<span
class="flex w-full flex-col justify-between lg:flex-row">
<span
class:preset-tonal-error={event_file_obj.extension == 'doc' || event_file_obj.extension == 'ppt' || event_file_obj.extension == 'xls'}
class:hidden={display_mode !=
'default'}>
'default'}
title={(event_file_obj.extension == 'doc' || event_file_obj.extension == 'ppt' || event_file_obj.extension == 'xls') ? `WARNING: Microsoft 2003 legacy file type. Please resave this in a modern PowerPoint, Word, or Excel format!\nFile type = ${event_file_obj.extension}\nContent type = ${event_file_obj.content_type}` : `File type = ${event_file_obj.extension}\nContent type = ${event_file_obj.content_type}`}
>
Type:
<strong
>{event_file_obj.extension}
>
<ExtIcon
size="1em"
class="inline-block" />
{event_file_obj.extension}
{#if event_file_obj.extension == 'doc' || event_file_obj.extension == 'ppt' || event_file_obj.extension == 'xls'}
<!-- Legacy warning icon -->
<OctagonAlert
size="1em"
class="inline-block" />
{/if}
</strong>
<!-- {#if event_file_obj.open_in_os == 'win'}
<strong>