diff --git a/backend/app/api/v1/endpoints/projects.py b/backend/app/api/v1/endpoints/projects.py index e4c8a59..c7b5f2e 100644 --- a/backend/app/api/v1/endpoints/projects.py +++ b/backend/app/api/v1/endpoints/projects.py @@ -19,7 +19,7 @@ from app.models.audit import AuditTask, AuditIssue from app.models.agent_task import AgentTask, AgentTaskStatus, AgentFinding from app.models.user_config import UserConfig import zipfile -from app.services.scanner import scan_repo_task, get_github_files, get_gitlab_files, get_github_branches, get_gitlab_branches, get_gitea_branches, should_exclude, is_text_file +from app.services.scanner import scan_repo_task, get_github_files, get_gitlab_files, get_gitea_files, get_github_branches, get_gitlab_branches, get_gitea_branches, should_exclude, is_text_file from app.services.zip_storage import ( save_project_zip, load_project_zip, get_project_zip_meta, delete_project_zip, has_project_zip @@ -451,6 +451,7 @@ async def get_project_files( else: # 使用API方式获取文件列表 repo_type = project.repository_type or "other" + gitea_token = settings.GITEA_TOKEN if repo_type == "github": # 传入用户自定义排除模式 @@ -460,6 +461,10 @@ async def get_project_files( # 传入用户自定义排除模式 repo_files = await get_gitlab_files(project.repository_url, target_branch, gitlab_token, parsed_exclude_patterns) files = [{"path": f["path"], "size": 0} for f in repo_files] + elif repo_type == "gitea": + # 传入用户自定义排除模式 + repo_files = await get_gitea_files(project.repository_url, target_branch, gitea_token, parsed_exclude_patterns) + files = [{"path": f["path"], "size": 0} for f in repo_files] else: raise HTTPException(status_code=400, detail="不支持的仓库类型") except HTTPException: