Closed clarkwinkelmann closed 2 years ago
I absolutely love the idea, I'm not too sure about the implementation. It would, imo, make more sense to have a "adopt mimetype from uploaded sample" or "add mimetype entry from uploaded sample". What do you think?
I'm a bit worried people will insert dangerous MIME types in their configuration if it can be done in a single click without giving it any thought.
My main intent with the tool is that if someone has an issue, we can ask them to use it and share the output.
There's also always the issue that for some special file types, you will need to test multiple files to find all the MIME types that might be detected. And then this would have to be converted into a regex.
I was considering showing which of the saved configurations matches the given file, but I feel like it adds too much complexity. This extension is already quite complex so I was hoping to keep this as simple and isolated as possible so it doesn't give us trouble later on when we need to refactor other things :innocent:
Requesting @imorland 's feedback to decide if we should move forward with this feature
Changes proposed in this pull request: Add a new utility to the admin panel where files can be dropped to see their MIME type and guessed extension.
Reviewers should focus on: The feature is mostly standalone. It re-uses the file repository but only to copy the file to the temporary folder. The file is never persisted to database or assets folder.
Are the labels explanatory enough? Is the placement of the test button good?
Screenshot Example with common file:
Example with fallback:
Button to access the tool is below MIME configuration:
![image](https://user-images.githubusercontent.com/5264300/154865563-dc044bb2-f53e-4e8e-b87a-5d648a9a04e3.png)
Confirmed
composer test
).