From 67118a34fd954bfff822aaae657f1f9d9abc1533 Mon Sep 17 00:00:00 2001 From: Stefan Hacker Date: Sat, 11 Apr 2026 20:53:47 +0200 Subject: [PATCH] fix: Share-View Loeschen nutzt jetzt Papierkorb statt hartem Delete MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - share_delete_file nutzt _trash_recursive() statt db.session.delete() - Geloeschte Dateien aus Share-Links landen im Papierkorb des Eigentümers - Share-Dateiliste filtert getrashte Dateien aus (is_trashed=False) Co-Authored-By: Claude Opus 4.6 (1M context) --- backend/app/api/files.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/backend/app/api/files.py b/backend/app/api/files.py index d7ada5f..fecbbbf 100644 --- a/backend/app/api/files.py +++ b/backend/app/api/files.py @@ -696,7 +696,7 @@ def share_list_files(token): if not target_parent or not _is_inside_shared_folder(target_parent, shared_folder.id): return jsonify({'error': 'Zugriff verweigert'}), 403 - files = File.query.filter_by(parent_id=parent_id)\ + files = File.query.filter_by(parent_id=parent_id, is_trashed=False)\ .order_by(File.is_folder.desc(), File.name).all() # Build breadcrumb from current parent back to shared root @@ -821,15 +821,10 @@ def share_delete_file(token, file_id): if not _is_inside_shared_folder(target_file, link.file_id): return jsonify({'error': 'Datei gehoert nicht zu diesem Ordner'}), 403 - # Delete from disk - if target_file.storage_path: - filepath = Path(current_app.config['UPLOAD_PATH']) / str(target_file.owner_id) / target_file.storage_path - if filepath.exists(): - filepath.unlink() - - db.session.delete(target_file) + # Soft-delete: move to trash + _trash_recursive(target_file) db.session.commit() - return jsonify({'message': 'Datei geloescht'}), 200 + return jsonify({'message': 'In Papierkorb verschoben'}), 200 @api_bp.route('/share//verify', methods=['POST'])