mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-08-03 18:54:40 -05:00

@schinkelg ran aground of this one and I took the opportunity to add a test to catch this sort of thing for next time.
24 lines
478 B
Python
24 lines
478 B
Python
import re
|
|
|
|
from .parsers import RasterisedDocumentParser
|
|
|
|
|
|
class ConsumerDeclaration(object):
|
|
|
|
MATCHING_FILES = re.compile("^.*\.(pdf|jpg|gif|png|tiff?|pnm|bmp)$")
|
|
|
|
@classmethod
|
|
def handle(cls, sender, **kwargs):
|
|
return cls.test
|
|
|
|
@classmethod
|
|
def test(cls, doc):
|
|
|
|
if cls.MATCHING_FILES.match(doc.lower()):
|
|
return {
|
|
"parser": RasterisedDocumentParser,
|
|
"weight": 0
|
|
}
|
|
|
|
return None
|