]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
consumer.py: read `create_date` from original file (instead of temp copy)
authorchrisblech <chrisblech@users.noreply.github.com>
Thu, 25 May 2023 21:17:55 +0000 (23:17 +0200)
committerTrenton H <797416+stumpylog@users.noreply.github.com>
Fri, 26 May 2023 21:16:27 +0000 (14:16 -0700)
In line 328, `self.path` is set to a fresh written copy of the source file. This copy has a different timestamp (=now).

When using the source file's timestamp as `create_date`, it makes much more sense to ask for the timestamp from `self.original_path`

src/documents/consumer.py

index 7c4ddf003970b0ff20a329b665e6a68f4c901e2b..7ccc8336a605bdfb0a52c9eb95b2e170314cf025 100644 (file)
@@ -530,7 +530,7 @@ class Consumer(LoggingMixin):
             create_date = date
             self.log.debug(f"Creation date from parse_date: {create_date}")
         else:
-            stats = os.stat(self.path)
+            stats = os.stat(self.original_path)
             create_date = timezone.make_aware(
                 datetime.datetime.fromtimestamp(stats.st_mtime),
             )