]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Don't allow an exception when trying to parse a date cause complete failure 1998/head
authorTrenton H <797416+stumpylog@users.noreply.github.com>
Thu, 17 Nov 2022 21:37:37 +0000 (13:37 -0800)
committerTrenton H <797416+stumpylog@users.noreply.github.com>
Thu, 17 Nov 2022 21:37:37 +0000 (13:37 -0800)
src/documents/consumer.py
src/documents/parsers.py

index f542a1d98ab36aba74eeefbafc0f9cce59dfb6aa..d8138019190f885872bdfc51cc2631e442289224 100644 (file)
@@ -444,7 +444,12 @@ class Consumer(LoggingMixin):
 
         return document
 
-    def _store(self, text, date, mime_type) -> Document:
+    def _store(
+        self,
+        text: str,
+        date: Optional[datetime.datetime],
+        mime_type: str,
+    ) -> Document:
 
         # If someone gave us the original filename, use it instead of doc.
 
index f621996775699480e35f0a5ba5077d4e5d43b9b2..e2309b366521aaeef24194d451d6c8885f42c1be 100644 (file)
@@ -260,7 +260,7 @@ def parse_date_generator(filename, text) -> Iterator[datetime.datetime]:
 
         try:
             date = __parser(date_string, date_order)
-        except (TypeError, ValueError):
+        except Exception:
             # Skip all matches that do not parse to a proper date
             date = None