diff --git a/admin/dashboard/blueprints/file_browser.py b/admin/dashboard/blueprints/file_browser.py index c218c52..9adb6f6 100644 --- a/admin/dashboard/blueprints/file_browser.py +++ b/admin/dashboard/blueprints/file_browser.py @@ -37,6 +37,9 @@ def list_files(): "modified": os.path.getmtime(item_path) }) + # 对文件列表进行排序:目录在前,同类型按名称排序 + items.sort(key=lambda x: (not x["is_dir"], x["name"].lower())) + return jsonify({ "success": True, "data": {