From 7ffcdd2b68b8db5c3dd111e4eff7f5efc2180465 Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa <72977554+Cristhianzl@users.noreply.github.com> Date: Tue, 23 Jul 2024 14:06:16 -0300 Subject: [PATCH] bugfix: filter flows on folder to ensure is displaying only for the logged user (#2897) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🐛 (generalBugs-shard-5.spec.ts): fix test to wait for elements to be interactable before performing actions to prevent flakiness * 🐛 (folders.py): fix issue where all flows were being returned instead of only flows from the current user in the specified folder --- src/backend/base/langflow/api/v1/folders.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/backend/base/langflow/api/v1/folders.py b/src/backend/base/langflow/api/v1/folders.py index ba9e7c61b..d15d3a4ab 100644 --- a/src/backend/base/langflow/api/v1/folders.py +++ b/src/backend/base/langflow/api/v1/folders.py @@ -107,6 +107,8 @@ def read_folder( folder = session.exec(select(Folder).where(Folder.id == folder_id, Folder.user_id == current_user.id)).first() if not folder: raise HTTPException(status_code=404, detail="Folder not found") + flows_from_current_user_in_folder = [flow for flow in folder.flows if flow.user_id == current_user.id] + folder.flows = flows_from_current_user_in_folder return folder except Exception as e: if "No result found" in str(e):