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'])