fix: add missing Office macro-enabled MIME types to file allowlist#9047
fix: add missing Office macro-enabled MIME types to file allowlist#9047algojogacor wants to merge 1 commit into
Conversation
Add support for Microsoft Office macro-enabled and binary formats: - Excel: .xlsb, .xlsm, .xltm, .xlam - PowerPoint: .pptm, .ppsm, .potm, .ppam - Word: .docm, .dotm Fixes makeplane#9038
📝 WalkthroughWalkthroughThis pull request extends MIME type support for Microsoft Office macro-enabled and binary file formats across the backend API and frontend editor. The changes add 11 new MIME type strings to parallel allowlists in both ChangesMicrosoft Office MIME Type Support
🎯 1 (Trivial) | ⏱️ ~3 minutes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/editor/src/core/constants/config.ts (1)
19-80: ⚡ Quick winUse
satisfiesto avoid widening this MIME allowlist.Please define this constant with literal preservation + structural validation so accidental non-literal drift is caught earlier.
Suggested refactor
-export const ACCEPTED_ATTACHMENT_MIME_TYPES = [ +export const ACCEPTED_ATTACHMENT_MIME_TYPES = [ "image/jpeg", "image/png", "image/gif", "image/svg+xml", "image/webp", "image/tiff", "image/bmp", "application/pdf", "application/msword", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/vnd.ms-powerpoint", "application/vnd.openxmlformats-officedocument.presentationml.presentation", // Microsoft Office macro-enabled and binary formats "application/vnd.ms-excel.sheet.binary.macroEnabled.12", "application/vnd.ms-excel.sheet.macroEnabled.12", "application/vnd.ms-excel.template.macroEnabled.12", "application/vnd.ms-excel.addin.macroEnabled.12", "application/vnd.ms-powerpoint.presentation.macroEnabled.12", "application/vnd.ms-powerpoint.slideshow.macroEnabled.12", "application/vnd.ms-powerpoint.template.macroEnabled.12", "application/vnd.ms-powerpoint.addin.macroEnabled.12", "application/vnd.ms-word.document.macroEnabled.12", "application/vnd.ms-word.template.macroEnabled.12", "text/plain", "text/markdown", "application/rtf", "audio/mpeg", "audio/wav", "audio/ogg", "audio/midi", "audio/x-midi", "audio/aac", "audio/flac", "audio/x-m4a", "video/mp4", "video/mpeg", "video/ogg", "video/webm", "video/quicktime", "video/x-msvideo", "video/x-ms-wmv", "application/zip", "application/x-rar-compressed", "application/x-tar", "application/gzip", "model/gltf-binary", "model/gltf+json", "application/octet-stream", "font/ttf", "font/otf", "font/woff", "font/woff2", "text/css", "text/javascript", "application/json", "text/xml", "text/csv", "application/xml", -]; +] as const satisfies readonly string[];As per coding guidelines: "Use the
satisfiesoperator to validate types without widening them".🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/editor/src/core/constants/config.ts` around lines 19 - 80, The ACCEPTED_ATTACHMENT_MIME_TYPES array should preserve literal types and be structurally validated; change its declaration to use "as const" together with the TypeScript "satisfies" operator (e.g., declare ACCEPTED_ATTACHMENT_MIME_TYPES with as const and satisfy readonly string[] or a more specific readonly string[] type) so elements remain literal types while still validating the shape, ensuring accidental widening is caught at compile time.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/editor/src/core/constants/config.ts`:
- Around line 19-80: The ACCEPTED_ATTACHMENT_MIME_TYPES array should preserve
literal types and be structurally validated; change its declaration to use "as
const" together with the TypeScript "satisfies" operator (e.g., declare
ACCEPTED_ATTACHMENT_MIME_TYPES with as const and satisfy readonly string[] or a
more specific readonly string[] type) so elements remain literal types while
still validating the shape, ensuring accidental widening is caught at compile
time.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 2b8df194-c300-45f3-acbb-3d41177ddf59
📒 Files selected for processing (2)
apps/api/plane/settings/common.pypackages/editor/src/core/constants/config.ts
|
|
Description
Add missing MIME type support for Microsoft Office macro-enabled and binary file formats. These file types (.xlsb, .xlsm, .xltm, .xlam, .pptm, .ppsm, .potm, .ppam, .docm, .dotm) were not included in the attachment MIME type allowlists, preventing users from uploading these common Office file formats.
Updated both:
apps/api/plane/settings/common.py—ATTACHMENT_MIME_TYPESlistpackages/editor/src/core/constants/config.ts—ACCEPTED_ATTACHMENT_MIME_TYPESarrayType of Change
Screenshots and Media
N/A — this is a data-only change adding new string entries to existing arrays.
Test Scenarios
References
Fixes #9038
Summary by CodeRabbit