System updated with many bug revised
This commit is contained in:
+12
-1
@@ -340,9 +340,20 @@ def delete_project(project_name):
|
||||
return jsonify({"message": "deleted", "project": safe_name(project_name, 'project_1')})
|
||||
|
||||
|
||||
@app.route('/api/projects/<project_name>/cells/<cell_name>', methods=['PATCH'])
|
||||
@app.route('/api/projects/<project_name>/cells/<cell_name>', methods=['PATCH', 'DELETE'])
|
||||
@login_required_json
|
||||
def rename_cell(project_name, cell_name):
|
||||
if request.method == 'DELETE':
|
||||
cell = safe_name(cell_name, 'canvas_1')
|
||||
target = os.path.abspath(cell_file_path(project_name, cell))
|
||||
project_dir = os.path.abspath(project_root(project_name))
|
||||
if not target.startswith(project_dir + os.sep):
|
||||
return jsonify({"error": "Invalid cell path"}), 400
|
||||
if not os.path.exists(target):
|
||||
return jsonify({"message": "already deleted", "cell": cell})
|
||||
os.remove(target)
|
||||
return jsonify({"message": "deleted", "cell": cell})
|
||||
|
||||
data = request.get_json(silent=True) or {}
|
||||
old_cell = safe_name(cell_name, 'canvas_1')
|
||||
new_cell = safe_name(data.get('name'), old_cell)
|
||||
|
||||
Reference in New Issue
Block a user