Skip to content

Add MIME type restriction to system upload interface#26646

Merged
AlexGaillard merged 8 commits intomainfrom
alexgaillard/cms-1679-add-mime-type-restriction-to-system-upload-interface
Feb 16, 2026
Merged

Add MIME type restriction to system upload interface#26646
AlexGaillard merged 8 commits intomainfrom
alexgaillard/cms-1679-add-mime-type-restriction-to-system-upload-interface

Conversation

@AlexGaillard
Copy link
Member

@AlexGaillard AlexGaillard commented Feb 12, 2026

Scope

NOTE: This is part 1 of 3 for this feature

What's changed:

  • Whilst the MIME type allow list is enforced on the API side, the system upload interface does not take this into account, as such a user is allowed to select a restricted file type only to be met with an error.
  • This PR adds functionality that fetches the allowed MIME Types from the API to the APP
  • This then plugs the allowed MIME types into the system level file interface so when a user tries to upload a file they cannot select disallowed MIME types from the browser based file select input

Potential Risks / Drawbacks

  • File uploads break

Tested Scenarios

  • Restrict a MIME Type from you env eg: # FILES_MIME_TYPE_ALLOW_LIST=audio/*,image/* then try to upload a file type not in this list, it should be greyed out in the browser file input

Review Notes / Questions

  • NA

Checklist

  • Added or updated tests
  • Documentation PR created here or not required
  • OpenAPI package PR created here or not required

Fixes CMS-1679

@linear
Copy link

linear bot commented Feb 12, 2026

Copy link
Member

@HZooly HZooly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! Some changes if you agree for reducing potential dead code and improve typing.

@codecov
Copy link

codecov bot commented Feb 16, 2026

Codecov Report

❌ Patch coverage is 81.25000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.74%. Comparing base (127db21) to head (fb07bf6).
⚠️ Report is 1 commits behind head on main.

❌ Your patch status has failed because the patch coverage (0.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #26646   +/-   ##
=======================================
  Coverage   64.74%   64.74%           
=======================================
  Files        2186     2186           
  Lines      145076   145091   +15     
  Branches    10348    10349    +1     
=======================================
+ Hits        93931    93943   +12     
- Misses      51145    51148    +3     
Flag Coverage Δ
api 49.23% <0.00%> (-0.01%) ⬇️
app 75.22% <100.00%> (+<0.01%) ⬆️
composables 82.35% <ø> (ø)
create-directus-extension 94.44% <ø> (ø)
create-directus-project 98.43% <ø> (ø)
env 99.68% <ø> (ø)
errors 97.26% <ø> (ø)
extensions 35.63% <ø> (ø)
extensions-registry 95.27% <ø> (ø)
extensions-sdk 14.33% <ø> (ø)
format-title 100.00% <ø> (ø)
memory 100.00% <ø> (ø)
pressure 77.63% <ø> (ø)
release-notes-generator 81.14% <ø> (ø)
schema-builder 81.42% <ø> (ø)
sdk 25.68% <ø> (ø)
storage 92.00% <ø> (ø)
storage-driver-azure 76.76% <ø> (ø)
storage-driver-cloudinary 81.14% <ø> (ø)
storage-driver-gcs 69.72% <ø> (ø)
storage-driver-local 69.76% <ø> (ø)
storage-driver-s3 52.04% <ø> (ø)
storage-driver-supabase 68.63% <ø> (ø)
system-data 72.54% <ø> (ø)
update-check 55.67% <ø> (ø)
utils 90.95% <ø> (ø)
validation 44.50% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@AlexGaillard AlexGaillard requested a review from HZooly February 16, 2026 17:21
Copy link
Member

@HZooly HZooly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@AlexGaillard AlexGaillard merged commit 9e600c0 into main Feb 16, 2026
69 of 70 checks passed
@AlexGaillard AlexGaillard deleted the alexgaillard/cms-1679-add-mime-type-restriction-to-system-upload-interface branch February 16, 2026 20:56
@github-actions github-actions bot added this to the Next Release milestone Feb 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants