From baee449cd9414e44234fcf903d2a6cacb7b0c1ba Mon Sep 17 00:00:00 2001 From: liuwei Date: Wed, 4 Jun 2025 15:54:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=B5=8F=E8=A7=88=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/dashboard/blueprints/file_browser.py | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/admin/dashboard/blueprints/file_browser.py b/admin/dashboard/blueprints/file_browser.py index 9adb6f6..6e3e562 100644 --- a/admin/dashboard/blueprints/file_browser.py +++ b/admin/dashboard/blueprints/file_browser.py @@ -26,10 +26,38 @@ def list_files(): if not os.path.exists(full_path): return jsonify({"success": False, "message": "目录不存在"}) + # 需要隐藏的目录列表 + hidden_dirs = { + '__pycache__', + '.git', + '.idea', + '.venv', + 'venv', + 'env', + 'node_modules', + '.vscode', + '.pytest_cache', + '.coverage', + 'htmlcov', + 'dist', + 'build', + '.eggs', + '*.egg-info' + } + items = [] for item in os.listdir(full_path): + # 跳过隐藏文件和目录 + if item.startswith('.'): + continue + item_path = os.path.join(full_path, item) is_dir = os.path.isdir(item_path) + + # 跳过隐藏目录 + if is_dir and item in hidden_dirs: + continue + items.append({ "name": item, "is_dir": is_dir,