Fix issue with rar mimetypes

* Also removed some xfails from file catalog for tests that are now passing
pull/21/head
Dan Puttick 2017-08-11 18:41:00 -04:00
parent 7b275c7e6f
commit a1585113cd
3 changed files with 4 additions and 5 deletions

View File

@ -13,7 +13,7 @@ class Config:
mimes_pdf = ('pdf', 'postscript',)
mimes_xml = ('xml',)
mimes_ms = ('dosexec',)
mimes_compressed = ('zip', 'rar', 'bzip2', 'lzip', 'lzma', 'lzop',
mimes_compressed = ('zip', 'rar', 'x-rar', 'bzip2', 'lzip', 'lzma', 'lzop',
'xz', 'compress', 'gzip', 'tar',)
mimes_data = ('octet-stream',)
@ -31,6 +31,7 @@ class Config:
'application/x-dosexec': 'application/x-msdos-program',
# Other apps with confusing mimetypes
'application/rtf': 'text/rtf',
'application/rar': 'application/x-rar'
}
# EXTS

View File

@ -92,7 +92,7 @@ class File(FileBase):
expected_mimetype = Config.aliases[expected_mimetype]
is_known_extension = self.extension in mimetypes.types_map.keys()
if is_known_extension and expected_mimetype != self.mimetype:
self.make_dangerous('Mimetype does not match expected mimetype for this extension')
self.make_dangerous('Mimetype does not match expected mimetype ({}) for this extension'.format(expected_mimetype))
def _check_mimetype(self):
"""

View File

@ -12,7 +12,6 @@ normal:
Example.ogg: # Added: 27-06-2017, source: https://en.wikipedia.org/wiki/File:Example.ogg
description: Ogg vorbis sound file
mimetype: audio/ogg
xfail: True
Example.png: # Added: 27-06-2017, source: https://en.wikipedia.org/wiki/File:Example.png
mimetype: image/png
pdf-sample.pdf: # Added: 27-06-2017, source: http://che.org.il/wp-content/uploads/2016/12/pdf-sample.pdf
@ -22,14 +21,13 @@ normal:
rar_archive.rar: # Added: 27-06-2017, Rar archive. Source: hand-generated
description: rar archive
mimetype: application/x-rar
xfail: True
rich_text.rtf: # Added 27-06-2017), source: hand-generated
mimetype: text/rtf
sample_mpeg4.mp4: # Added 28-06-2017, source: https://support.apple.com/en-us/HT201549
mimetype: video/mp4
word_docx.docx: # Added 24-07-2017, source: hand-generated using MacOS Microsoft Word 2011
description: normal word document
# mimetype:
mimetype: application/vnd.openxmlformats-officedocument.wordprocessingml.document
zip_archive.zip: # Added 27-06-2017, source: hand-generated
mimetype: application/zip