Open rocket-turtle opened 2 years ago
@rocket-turtle can you please provide a sample xml file for us to test and work on the issue. Thanks!
@ssinghi I can not upload an XML file here.
I used this from https://www.w3schools.com/XML/xml_namespaces.asp
<?xml version="1.0" encoding="UTF-8"?>
<table xmlns="http://www.w3.org/TR/html4/">
<tr>
<td>Apples</td>
<td>Bananas</td>
</tr>
</table>
file -b --mime example.xml
text/xml; charset=us-ascii
Marcel::MimeType.for Pathname.new('example.xml'), name: 'example.xml'
"application/xml"
When I removed the otional XML Prolog (https://www.w3schools.com/xml/xml_syntax.asp) I get the same result from Marcel::MimeType.for but file returns text/html
:
file -b --mime example.xml
text/html; charset=us-ascii
Hi!
I'm also getting this kind of warnings. e.g:
INFO: [paperclip] Content Type Spoof: Filename 20222022_Teaser_Silex.pdf (application/pdf from Headers, [“application/pdf”] from Extension), content type discovered from file command: inode/x-empty. See documentation to allow this combination.
Content Type Spoof: Filename Règles_de_gouvernance_.pdf (application/pdf from Headers, [“application/pdf”] from Extension), content type discovered from file command: inode/x-empty. See documentation to allow this combination.
Describe the bug After updating to the version v7.1 we get this 'error':
I think the detection for the content_type changed with https://github.com/kreeti/kt-paperclip/pull/75
New behavior:
Old behavior:
Mime type from file (Mac OS)
Correct solution?
Is this the best way to handle this Problem? Are there any other known content_type changes?
Is there a best of for
Paperclip.options[:content_type_mappings]
?Update I found out that it depends on the XML file what the file command returns:
So my updated solution would be: