From 8e9d1cdd18dcd6bf215231e64614704e7d8dc194 Mon Sep 17 00:00:00 2001 From: Florian Brandes Date: Sat, 2 Apr 2022 07:23:31 +0200 Subject: [PATCH] uses shutil.move instead of rename fixes issues with cross-filesystem movement Signed-off-by: Florian Brandes --- src/documents/signals/handlers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/documents/signals/handlers.py b/src/documents/signals/handlers.py index 1b3f3b577..71f2cdc55 100644 --- a/src/documents/signals/handlers.py +++ b/src/documents/signals/handlers.py @@ -1,5 +1,6 @@ import logging import os +import shutil from django.conf import settings from django.contrib.admin.models import ADDITION @@ -252,7 +253,7 @@ def cleanup_document_deletion(sender, instance, using, **kwargs): logger.debug(f"Moving {instance.source_path} to trash at {new_file_path}") try: - os.rename(instance.source_path, new_file_path) + shutil.move(instance.source_path, new_file_path) except OSError as e: logger.error( f"Failed to move {instance.source_path} to trash at "