]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Ignore errors when trying to copy the original file's stats
authorTrenton H <797416+stumpylog@users.noreply.github.com>
Wed, 21 Jun 2023 14:33:56 +0000 (07:33 -0700)
committerTrenton H <797416+stumpylog@users.noreply.github.com>
Wed, 21 Jun 2023 14:54:27 +0000 (07:54 -0700)
src/documents/consumer.py

index f2da2ff42a2103c47fa5d70882b56ccd91c921fd..fde8e2d4c23ccc716a41f1a1bdaa25f58159772c 100644 (file)
@@ -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):
         """