diff --git a/app/routers/api_v3_actions_hosted_file.py b/app/routers/api_v3_actions_hosted_file.py index 3f28a78..fbc3dbf 100644 --- a/app/routers/api_v3_actions_hosted_file.py +++ b/app/routers/api_v3_actions_hosted_file.py @@ -433,8 +433,12 @@ async def delete_file_action( if method == 'delete': # Hard delete: Record + Disk if file_exists_on_disk: - pathlib.Path(file_path).unlink() - physical_removed = True + try: + pathlib.Path(file_path).unlink() + physical_removed = True + except OSError as e: + log.error(f"Error unlinking file {file_path}: {e}") + physical_removed = False sql_delete(table_name='hosted_file', record_id=file_id_int) record_removed = True elif method == 'hide':