From bef25781dede466ba4613fb88d4292faf4cdddb2 Mon Sep 17 00:00:00 2001 From: Aakash Bakhle <48802744+aakashb95@users.noreply.github.com> Date: Fri, 22 May 2026 11:55:16 +0530 Subject: [PATCH] feat(attachments): add XML and PFX file support (#14539) Update frontend allowed file types and FileIcon mapping, and backend Attachment constants to accept .xml and .pfx files # Pull Request Template ## Description Customer also wanted XML support along with .pfx Following up on #14456 ## Type of change - [x] New feature (non-breaking change which adds functionality) ## How Has This Been Tested? Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration. locally CleanShot 2026-05-22 at 11 43 20@2x CleanShot 2026-05-22 at 11 44 03@2x ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [x] I have commented on my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [x] Any dependent changes have been merged and published in downstream modules --- app/javascript/dashboard/components-next/icon/FileIcon.vue | 1 + app/javascript/shared/constants/messages.js | 4 +++- app/models/attachment.rb | 5 +++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/javascript/dashboard/components-next/icon/FileIcon.vue b/app/javascript/dashboard/components-next/icon/FileIcon.vue index d82be3e69..66a971bc6 100644 --- a/app/javascript/dashboard/components-next/icon/FileIcon.vue +++ b/app/javascript/dashboard/components-next/icon/FileIcon.vue @@ -27,6 +27,7 @@ const fileTypeIcon = computed(() => { txt: 'i-woot-file-txt', xls: 'i-woot-file-xls', xlsx: 'i-woot-file-xls', + xml: 'i-woot-file-txt', zip: 'i-woot-file-zip', }; diff --git a/app/javascript/shared/constants/messages.js b/app/javascript/shared/constants/messages.js index 989aa12ca..18bc380ec 100644 --- a/app/javascript/shared/constants/messages.js +++ b/app/javascript/shared/constants/messages.js @@ -39,12 +39,14 @@ export const ALLOWED_FILE_TYPES = 'audio/*,' + 'video/*,' + '.3gpp,' + + '.xls, .xlsx, .xml, .pfx,' + 'text/csv, text/plain, application/json, application/pdf, text/rtf,' + 'application/xml, text/xml,' + 'application/zip, application/x-7z-compressed application/vnd.rar application/x-tar,' + 'application/msword, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/vnd.oasis.opendocument.text,' + 'application/vnd.openxmlformats-officedocument.presentationml.presentation, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,' + - 'application/vnd.openxmlformats-officedocument.wordprocessingml.document,'; + 'application/vnd.openxmlformats-officedocument.wordprocessingml.document,' + + 'application/x-pkcs12, application/pkcs12,'; export const CSAT_RATINGS = [ { diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 102d90beb..79a8021b3 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -25,8 +25,9 @@ class Attachment < ApplicationRecord include Rails.application.routes.url_helpers ACCEPTABLE_FILE_TYPES = %w[ - text/csv text/plain text/rtf + text/csv text/plain text/rtf text/xml application/json application/pdf + application/xml application/zip application/x-7z-compressed application/vnd.rar application/x-tar application/msword application/vnd.ms-excel application/vnd.ms-powerpoint application/rtf application/vnd.oasis.opendocument.text @@ -35,7 +36,7 @@ class Attachment < ApplicationRecord application/vnd.openxmlformats-officedocument.wordprocessingml.document application/x-pkcs12 application/pkcs12 ].freeze - ACCEPTABLE_FILE_EXTENSIONS = %w[pfx].freeze + ACCEPTABLE_FILE_EXTENSIONS = %w[pfx xml].freeze GENERIC_FILE_CONTENT_TYPES = %w[application/octet-stream].freeze belongs_to :account belongs_to :message