fix: allow for caps in file name suffixes #206

@schinkelg ran aground of this one and I took the opportunity to add a
test to catch this sort of thing for next time.
This commit is contained in:
Daniel Quinn
2017-03-28 21:01:50 +00:00
parent bc1cfadd69
commit e7d4ca92ba
5 changed files with 102 additions and 3 deletions

View File

@@ -5,7 +5,7 @@ from .parsers import RasterisedDocumentParser
class ConsumerDeclaration(object):
MATCHING_FILES = re.compile("^.*\.(pdf|jpg|gif|png|tiff|pnm|bmp)$")
MATCHING_FILES = re.compile("^.*\.(pdf|jpg|gif|png|tiff?|pnm|bmp)$")
@classmethod
def handle(cls, sender, **kwargs):
@@ -14,7 +14,7 @@ class ConsumerDeclaration(object):
@classmethod
def test(cls, doc):
if cls.MATCHING_FILES.match(doc):
if cls.MATCHING_FILES.match(doc.lower()):
return {
"parser": RasterisedDocumentParser,
"weight": 0