From 1c66daf12b2f7faf11360a91c6e69b136b2929a1 Mon Sep 17 00:00:00 2001 From: Trenton H <797416+stumpylog@users.noreply.github.com> Date: Wed, 21 Jun 2023 07:33:56 -0700 Subject: [PATCH] Ignore errors when trying to copy the original file's stats --- src/documents/consumer.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/documents/consumer.py b/src/documents/consumer.py index f2da2ff42..fde8e2d4c 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): """