From: Trenton H <797416+stumpylog@users.noreply.github.com> Date: Wed, 21 Jun 2023 14:33:56 +0000 (-0700) Subject: Ignore errors when trying to copy the original file's stats X-Git-Tag: v1.16.3~6^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1c66daf12b2f7faf11360a91c6e69b136b2929a1;p=thirdparty%2Fpaperless-ngx.git Ignore errors when trying to copy the original file's stats --- diff --git a/src/documents/consumer.py b/src/documents/consumer.py index f2da2ff42a..fde8e2d4c2 100644 --- a/src/documents/consumer.py +++ b/src/documents/consumer.py @@ -582,7 +582,12 @@ class Consumer(LoggingMixin): def _write(self, storage_type, source, target): with open(source, "rb") as read_file, open(target, "wb") as write_file: write_file.write(read_file.read()) - shutil.copystat(source, target) + + # Attempt to copy file's original stats, but it's ok if we can't + try: + shutil.copystat(source, target) + except Exception: # pragma: no cover + pass def _log_script_outputs(self, completed_process: CompletedProcess): """