Problem/Motivation
The File Inspector settings form allows administrators to configure the MIME types that should be inspected. However, the inspection service does not read or apply the inspection.allowed_mime_types configuration.
As a result, files with MIME types not included in the allowed list are still inspected and added to the File Inspector report.
Steps to reproduce
- Install and enable the File Inspector module.
-
Navigate to the File Inspector settings page:
/admin/config/media/file-inspector. -
Remove the existing values from Allowed MIME Types, enter only
image/png, and save the configuration. - Create two unmanaged test files (file-inspector-test.png & file-inspector-test.txt) in the public file directory (/sites/default/files).
-
Navigate to the Batch Operations page:
/admin/config/media/file-inspector/batch. - Run a new file inspection and wait for it to complete.
-
Navigate to the File Inspector report:
/admin/reports/file-inspector/files. -
Enter
file-inspector-testin the File name filter and
click Filter. -
Observe that both
file-inspector-test.pngand
file-inspector-test.txtappear in the report, even though only
image/pngis configured as an allowed MIME type.
Proposed resolution
Apply the configured inspection.allowed_mime_types values while processing discovered files. Support both exact MIME types, such as image/jpeg, and wildcard values, such as image/*.
Issue fork file_inspector-3605281
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #5
lpeidro commentedHello DHmishra, thank you for your colaboration.
I have fixed the issue and added the unit test to ensure the funcionality works and we will not lose it in the future.
Now the system excludes from the analisys the mime types that are not include in the Allowed list.
Comment #7
dkmishra commentedHi @lpeidro, thank you for the fix and for adding the unit test.
I have tested the changes on my end and can confirm that the issue is resolved. The updated behavior of excluding MIME types not included in the allowed list is working as expected.
Thanks again for the quick turnaround.