From: Freilichtbühne <52177341+Freilichtbuehne@users.noreply.github.com> Date: Wed, 28 May 2025 22:13:03 +0000 (+0200) Subject: Fix: Add exception to `utime` in `copy_basic_file_stats` (#10070) X-Git-Tag: v2.16.3~1^2~27 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=bfaab215899423e9e25e9998ae9c5aef445de39d;p=thirdparty%2Fpaperless-ngx.git Fix: Add exception to `utime` in `copy_basic_file_stats` (#10070) --- diff --git a/src/documents/utils.py b/src/documents/utils.py index e75194d82..04aa95bce 100644 --- a/src/documents/utils.py +++ b/src/documents/utils.py @@ -23,11 +23,17 @@ def copy_basic_file_stats(source: Path | str, dest: Path | str) -> None: The extended attribute copy does weird things with SELinux and files copied from temporary directories and copystat doesn't allow disabling - these copies + these copies. + + If there is a PermissionError, skip copying file stats. """ source, dest = _coerce_to_path(source, dest) src_stat = source.stat() - utime(dest, ns=(src_stat.st_atime_ns, src_stat.st_mtime_ns)) + + try: + utime(dest, ns=(src_stat.st_atime_ns, src_stat.st_mtime_ns)) + except PermissionError: + pass def copy_file_with_basic_stats(