From 4d7712ffe6faa936817672846852fe623bd9b74c Mon Sep 17 00:00:00 2001 From: Sami Alfattany Date: Wed, 11 Mar 2026 17:23:39 +0300 Subject: [PATCH 1/2] fix the CSRF token on delete files and directories use SecureForm fix fix fix fix fix fix Azure initial files fix fix fix fix add comment Co-authored-by: Copilot --- .../templates/bootstrap4/admin/file/list.html | 10 +- flask_admin/tests/fileadmin/test_fileadmin.py | 173 ++++++++++++++++++ .../tests/fileadmin/test_fileadmin_azure.py | 15 +- .../tests/fileadmin/test_fileadmin_s3.py | 1 + 4 files changed, 192 insertions(+), 7 deletions(-) diff --git a/flask_admin/templates/bootstrap4/admin/file/list.html b/flask_admin/templates/bootstrap4/admin/file/list.html index dc9be0191f..d12244b683 100644 --- a/flask_admin/templates/bootstrap4/admin/file/list.html +++ b/flask_admin/templates/bootstrap4/admin/file/list.html @@ -86,8 +86,11 @@ {% if name != '..' and admin_view.can_delete_dirs %}
{{ delete_form.path(value=path) }} + {% if delete_form.csrf_token is defined and delete_form.csrf_token %} - {{ delete_form.csrf_token }} + {{ delete_form.csrf_token }} + {% elif csrf_token is defined and csrf_token %} + {% endif %}