[BUGFIX] Correctly set MIME type of .js and .css files
Resolves: https://github.com/andersundsehr/aus_driver_amazon_s3/issues/85
I'm not sure if we should fix this mime type issue here in this driver. Do you know the real source of this issue? Can we solve it in a more generic way (eg. for all mime types)?
The TYPO3 core also has a similar problem and introduced the MimeTypeDetector:
- https://github.com/TYPO3/typo3/blob/11.5/typo3/sysext/core/Classes/Resource/MimeTypeDetector.php
There is a manual list of mappings, too, that is used by FileInfo:
- https://docs.typo3.org/c/typo3/cms-core/9.5/en-us/Changelog/7.2/Feature-66445-AddFileExtensionToMimeTypeMapping.html
- https://forge.typo3.org/projects/typo3cms-core/repository/1749/revisions/1c0420df596c9874acedbc4c0930f5c46182fde2/diff/typo3/sysext/core/Classes/Type/File/FileInfo.php
I don't know what the right solution is.
I've rebased against current master and fixed the code complexity by moving the code into a new method.
@Lagerregal: Shall I rewrite it to use the TYPO3 core mime type detector, or is the current list of css+js sufficient?
(Also, this only works for files that are not empty because the normal s3client uploader is used for empty files since #69, and I do not know how to pass the MIME type to that.
@cweiske thanks again for your contribution. I created another PR for that: #141 as i decided to use the TYPO3 mime-detector mappings for that issue.
As long as the issue gets finally solved I'm fine with that :)
Today we merged https://github.com/andersundsehr/aus_driver_amazon_s3/pull/141 which solves this issue