From 4950d74284e034257806004c142d4ae9db4bf4f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Tue, 21 Apr 2026 08:48:33 +0200 Subject: [PATCH] fix: accept .trace files and unblock .log in macOS file picker Add .trace to the upload screen's accepted extensions and broaden the file input's accept attribute with text/plain and application/octet-stream. macOS' UTI-based file picker was greying out .log (and would do the same for .trace) despite the extensions being listed; the broader MIME hints let users select them while JS-side validation still enforces the strict extension allowlist. Co-Authored-By: Claude Opus 4.7 (1M context) --- apps/web/src/components/load/FileUpload.tsx | 10 ++++++++-- docs/usage-guide.md | 2 +- spec/ui/sprint-10-file-upload.md | 4 ++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/apps/web/src/components/load/FileUpload.tsx b/apps/web/src/components/load/FileUpload.tsx index e23aeed..d6d395e 100644 --- a/apps/web/src/components/load/FileUpload.tsx +++ b/apps/web/src/components/load/FileUpload.tsx @@ -15,8 +15,14 @@ import { } from "react"; import { formatBadgeIntent, formatByteCount, formatLabel } from "./format"; -const ACCEPTED_EXTENSIONS = [".jam", ".pvm", ".bin", ".log", ".json"]; -const ACCEPT_STRING = ACCEPTED_EXTENSIONS.join(","); +const ACCEPTED_EXTENSIONS = [".jam", ".pvm", ".bin", ".log", ".trace", ".json"]; +// Include broad MIME types so browsers (esp. macOS) don't grey out +// .log/.trace files in the system picker due to UTI matching quirks. +const ACCEPT_STRING = [ + ...ACCEPTED_EXTENSIONS, + "text/plain", + "application/octet-stream", +].join(","); export interface FileUploadResult { rawPayload: RawPayload; diff --git a/docs/usage-guide.md b/docs/usage-guide.md index 7323680..c4014c5 100644 --- a/docs/usage-guide.md +++ b/docs/usage-guide.md @@ -18,7 +18,7 @@ Use the examples column on the right to open bundled programs. The six categorie ### From File Upload -Drop a file or use the browse button to load `.jam`, `.pvm`, `.bin`, `.log`, or `.json` input from disk. +Drop a file or use the browse button to load `.jam`, `.pvm`, `.bin`, `.log`, `.trace`, or `.json` input from disk. ![Loader with an uploaded branch.pvm file selected](usage-screenshots/load-upload.png) diff --git a/spec/ui/sprint-10-file-upload.md b/spec/ui/sprint-10-file-upload.md index 6b84662..18a8925 100644 --- a/spec/ui/sprint-10-file-upload.md +++ b/spec/ui/sprint-10-file-upload.md @@ -10,7 +10,7 @@ Add file upload as a program source on the load page. Users can drag-and-drop or - Load page has a two-column layout: sources (left) + examples (right) - File upload supports drag-and-drop and file picker -- Accepted extensions: `.jam`, `.pvm`, `.bin`, `.log`, `.json` +- Accepted extensions: `.jam`, `.pvm`, `.bin`, `.log`, `.trace`, `.json` - Selected file shows name and byte count - Format is auto-detected through `detectFormat()` - `Continue` button appears and enables after valid file selection @@ -46,7 +46,7 @@ Use `loadUpload()` and `detectFormat()` from the content package. Rules: - support both drag-and-drop and file picker -- accept `.jam`, `.pvm`, `.bin`, `.log`, `.json` +- accept `.jam`, `.pvm`, `.bin`, `.log`, `.trace`, `.json` - show selected file name and byte count after selection - detect format automatically - the UI must not reimplement loading or format detection