mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-06 23:05:42 +01:00
added file type checks to the parsers to prevent temporary files from being consumed. Also: parsers announce file types they wish to use as default for each mime type.
This commit is contained in:
parent
64ee8eab2f
commit
f51207fc32
7 changed files with 83 additions and 21 deletions
|
|
@ -423,7 +423,7 @@ class TestConsumer(DirectoriesMixin, TestCase):
|
|||
m = patcher.start()
|
||||
m.return_value = [(None, {
|
||||
"parser": self.make_dummy_parser,
|
||||
"mime_types": ["application/pdf"],
|
||||
"mime_types": {"application/pdf": ".pdf"},
|
||||
"weight": 0
|
||||
})]
|
||||
|
||||
|
|
@ -519,7 +519,7 @@ class TestConsumer(DirectoriesMixin, TestCase):
|
|||
try:
|
||||
self.consumer.try_consume_file(self.get_test_file())
|
||||
except ConsumerError as e:
|
||||
self.assertTrue(str(e).startswith("No parsers abvailable"))
|
||||
self.assertTrue("File extension .pdf does not map to any" in str(e))
|
||||
return
|
||||
|
||||
self.fail("Should throw exception")
|
||||
|
|
@ -528,7 +528,7 @@ class TestConsumer(DirectoriesMixin, TestCase):
|
|||
def testFaultyParser(self, m):
|
||||
m.return_value = [(None, {
|
||||
"parser": self.make_faulty_parser,
|
||||
"mime_types": ["application/pdf"],
|
||||
"mime_types": {"application/pdf": ".pdf"},
|
||||
"weight": 0
|
||||
})]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue