FA-1353 Add “Text Documents” as a Vault File Type (Filter + Icon)#956
Conversation
There was a problem hiding this comment.
Pull request overview
Adds support for filtering gallery (“Vault”) items by a new Text Documents file type, spanning frontend filter UI, typed API client params, and backend filtering/validation.
Changes:
- Adds a new “Text Documents” option to the Gallery file type filter UI and sends
file_type=text_documentsto the API. - Extends the frontend API client typing for
getGalleryItemsto include"text_documents". - Adds backend support for filtering blobs by Word document types/extensions and validates
"text_documents"in the gallery endpoint.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| frontend/src/pages/gallery/Gallery.tsx | Adds “Text Documents” to the file type filter options shown in the Gallery UI. |
| frontend/src/api/api.ts | Updates getGalleryItems request param typing to allow "text_documents". |
| backend/gallery/blob_utils.py | Adds Word document content-type/extension detection and filtering for file_type=text_documents. |
| backend/app.py | Allows "text_documents" as a valid file_type query param value for the gallery endpoint. |
| const fileTypeFilterOptions = [ | ||
| { label: "All Types", value: "all" }, | ||
| { label: "Images", value: "images" }, | ||
| { label: "PowerPoint", value: "pptx" } | ||
| { label: "Images/Charts", value: "images" }, | ||
| { label: "Presentations", value: "pptx" }, | ||
| { label: "Text Documents", value: "text_documents" } |
There was a problem hiding this comment.
The new "Text Documents" filter value will cause the gallery to request file_type=text_documents, which (per backend changes) can include legacy .doc files. In this page, preview + placeholder icon logic only recognizes .docx via getOfficeExtension / shouldUseDocumentViewer, so .doc items will fall back to the image preview path and show the default presentation icon (and likely fail to preview). Please either add .doc handling end-to-end in the gallery (extension detection + viewer/icon), or restrict the backend filter to the formats the frontend can actually preview.
| TEXT_DOCUMENT_EXTENSIONS = {".docx", ".doc"} | ||
| TEXT_DOCUMENT_CONTENT_TYPES = { | ||
| "application/vnd.openxmlformats-officedocument.wordprocessingml.document", | ||
| "application/msword" |
There was a problem hiding this comment.
TEXT_DOCUMENT_EXTENSIONS / TEXT_DOCUMENT_CONTENT_TYPES include legacy .doc / application/msword, but the current frontend gallery preview component (PPTXViewer via shouldUseDocumentViewer) only detects .docx and won’t render .doc properly. To avoid returning files the UI can’t preview (and showing incorrect icons), either remove .doc/application/msword from this filter or ensure the frontend viewer/detection supports .doc consistently.
| TEXT_DOCUMENT_EXTENSIONS = {".docx", ".doc"} | |
| TEXT_DOCUMENT_CONTENT_TYPES = { | |
| "application/vnd.openxmlformats-officedocument.wordprocessingml.document", | |
| "application/msword" | |
| TEXT_DOCUMENT_EXTENSIONS = {".docx"} | |
| TEXT_DOCUMENT_CONTENT_TYPES = { | |
| "application/vnd.openxmlformats-officedocument.wordprocessingml.document" |
JIRA Ticket
FA-1353
Description
[Add support for text documents as a file type in gallery filtering]
Checklist