From b29b8f48958fd6d89ab5df1cf99b656321efa71a Mon Sep 17 00:00:00 2001 From: Sandeepgouda Goudar Date: Sat, 8 Aug 2026 18:59:14 +0530 Subject: [PATCH] fix: remove unsupported HTML upload option from admin document picker Frontend advertised HTML/HTM uploads that the backend has never supported. Closes out the unfinished TODO from the original commit rather than implementing backend HTML support. --- .../src/admin/pages/AdminContextSources.tsx | 14 +++----------- .../pages/__tests__/AdminContextSources.test.tsx | 1 + 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/apps/frontend/src/admin/pages/AdminContextSources.tsx b/apps/frontend/src/admin/pages/AdminContextSources.tsx index fb8f0c63..3c28f342 100644 --- a/apps/frontend/src/admin/pages/AdminContextSources.tsx +++ b/apps/frontend/src/admin/pages/AdminContextSources.tsx @@ -631,9 +631,6 @@ export function WebUrlView({ bare = false }: { bare?: boolean } = {}) { /** * UploadDocumentView — file-upload form + list for `DocumentAsset`. * Self-contained: owns its own state, fetches `/admin/documents`. - * v1.83 — `.html` / `.htm` added to the accept= list; uploads will - * still be rejected by the backend until ALLOWED_MIME in - * adminDocuments.controller.ts is extended (tracked as a TODO). */ export function UploadDocumentView({ bare = false }: { bare?: boolean } = {}) { const [items, setItems] = useState([]); @@ -704,7 +701,7 @@ export function UploadDocumentView({ bare = false }: { bare?: boolean } = {}) { } catch (e) { const status = (e as { response?: { status?: number } })?.response?.status; let msg = friendlyError(e, 'Upload failed.'); - if (status === 400) msg = 'That file type is not supported. Use PDF, TXT, MD, CSV, HTML, or HTM.'; + if (status === 400) msg = 'That file type is not supported. Use PDF, TXT, MD, or CSV.'; else if (status === 422) msg = 'We could not extract any text from that file.'; setUploadError(msg); } finally { @@ -810,12 +807,7 @@ export function UploadDocumentView({ bare = false }: { bare?: boolean } = {}) { {body} diff --git a/apps/frontend/src/admin/pages/__tests__/AdminContextSources.test.tsx b/apps/frontend/src/admin/pages/__tests__/AdminContextSources.test.tsx index a49bcc41..e98f6d12 100644 --- a/apps/frontend/src/admin/pages/__tests__/AdminContextSources.test.tsx +++ b/apps/frontend/src/admin/pages/__tests__/AdminContextSources.test.tsx @@ -373,6 +373,7 @@ describe('AdminContextSources', () => { const file = new File(['hello world'], 'uploaded.pdf', { type: 'application/pdf' }); const fileInput = screen.getByTestId('documents-file-input') as HTMLInputElement; + expect(fileInput.accept).toBe('.pdf,.txt,.md,.csv'); fireEvent.change(fileInput, { target: { files: [file] } }); // Selected-file hint surfaces.