From: chrisblech Date: Thu, 25 May 2023 21:17:55 +0000 (+0200) Subject: consumer.py: read `create_date` from original file (instead of temp copy) X-Git-Tag: v1.15.0~1^2~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3ab2892066088da5f51bb56c1ff4dd11ee60112e;p=thirdparty%2Fpaperless-ngx.git consumer.py: read `create_date` from original file (instead of temp copy) 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` --- diff --git a/src/documents/consumer.py b/src/documents/consumer.py index 7c4ddf0039..7ccc8336a6 100644 --- a/src/documents/consumer.py +++ b/src/documents/consumer.py @@ -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), )