From 7d285e862f86fa1d96ed04c4cd40a5f1b8f9189a Mon Sep 17 00:00:00 2001 From: Kyle Kelly <124007635+jkylekelly@users.noreply.github.com> Date: Wed, 27 Nov 2024 19:51:53 -0800 Subject: [PATCH] Update delete_workflow (#459) --- src/agentscope/studio/_app.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/agentscope/studio/_app.py b/src/agentscope/studio/_app.py index c474b805e..c8cb1a6be 100644 --- a/src/agentscope/studio/_app.py +++ b/src/agentscope/studio/_app.py @@ -764,6 +764,11 @@ def _delete_workflow() -> Response: if not filename: return jsonify({"error": "Filename is required"}) + if not filename.endswith(".json"): + return jsonify({"error": "Only JSON files can be deleted"}) + + filename = os.path.basename(filename) + filepath = os.path.join(user_dir, filename) if not os.path.exists(filepath): return jsonify({"error": "File not found"})