Closed JSv4 closed 3 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 70.18%. Comparing base (
55d5525
) to head (24ebca3
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Introduce File Type Checking for Document Uploads
Summary
This PR introduces MIME type and file type checking to the
UploadDocument
mutation. This new feature enhances security and ensures that only allowed file types can be uploaded through our system.Changes
UploadDocument Mutation
filetype
library to detect MIME types of uploaded filesNew Test Case (UploadDocumentMutationTestCase)
UploadDocument
mutationpython-docx
to generate a real DOCX file for accurate testingRationale
File type checking is crucial for:
Implementation Details
filetype
andpython-docx
as new dependenciesio.BytesIO()
for efficient file content handlingsettings.ALLOWED_DOCUMENT_MIMETYPES
Testing
Configuration
ALLOWED_DOCUMENT_MIMETYPES
to settings (currently set to['application/pdf']
)Next Steps
Breaking Changes