fix: .cc/.hh后缀文件无法进行纳入审计的问题.

This commit is contained in:
lintsinghua 2025-10-26 20:56:29 +08:00
parent 9fa3a18a4b
commit a54b8da672
4 changed files with 12 additions and 3 deletions

View File

@ -5,7 +5,7 @@ import { taskControl } from "@/shared/services/taskControl";
type GithubTreeItem = { path: string; type: "blob" | "tree"; size?: number; url: string; sha: string }; type GithubTreeItem = { path: string; type: "blob" | "tree"; size?: number; url: string; sha: string };
const TEXT_EXTENSIONS = [ const TEXT_EXTENSIONS = [
".js", ".ts", ".tsx", ".jsx", ".py", ".java", ".go", ".rs", ".cpp", ".c", ".h", ".cs", ".php", ".rb", ".kt", ".swift", ".sql", ".sh", ".json", ".yml", ".yaml" ".js", ".ts", ".tsx", ".jsx", ".py", ".java", ".go", ".rs", ".cpp", ".c", ".h", ".cc", ".hh", ".cs", ".php", ".rb", ".kt", ".swift", ".sql", ".sh", ".json", ".yml", ".yaml"
// 注意:已移除 .md因为文档文件会导致LLM返回非JSON格式 // 注意:已移除 .md因为文档文件会导致LLM返回非JSON格式
]; ];
const MAX_FILE_SIZE_BYTES = 200 * 1024; const MAX_FILE_SIZE_BYTES = 200 * 1024;

View File

@ -4,7 +4,7 @@ import { api } from "@/shared/config/database";
import { taskControl } from "@/shared/services/taskControl"; import { taskControl } from "@/shared/services/taskControl";
const TEXT_EXTENSIONS = [ const TEXT_EXTENSIONS = [
".js", ".ts", ".tsx", ".jsx", ".py", ".java", ".go", ".rs", ".cpp", ".c", ".h", ".js", ".ts", ".tsx", ".jsx", ".py", ".java", ".go", ".rs", ".cpp", ".c", ".h", ".cc", ".hh",
".cs", ".php", ".rb", ".kt", ".swift", ".sql", ".sh", ".json", ".yml", ".yaml" ".cs", ".php", ".rb", ".kt", ".swift", ".sql", ".sh", ".json", ".yml", ".yaml"
// 注意:已移除 .md因为文档文件会导致LLM返回非JSON格式 // 注意:已移除 .md因为文档文件会导致LLM返回非JSON格式
]; ];
@ -99,6 +99,9 @@ function getLanguageFromPath(path: string): string {
'rs': 'rust', 'rs': 'rust',
'cpp': 'cpp', 'cpp': 'cpp',
'c': 'cpp', 'c': 'cpp',
'cc': 'cpp',
'h': 'cpp',
'hh': 'cpp',
'cs': 'csharp', 'cs': 'csharp',
'php': 'php', 'php': 'php',
'rb': 'ruby', 'rb': 'ruby',

View File

@ -226,6 +226,9 @@ public class Example {
'rs': 'rust', 'rs': 'rust',
'cpp': 'cpp', 'cpp': 'cpp',
'c': 'cpp', 'c': 'cpp',
'cc': 'cpp',
'h': 'cpp',
'hh': 'cpp',
'cs': 'csharp', 'cs': 'csharp',
'php': 'php', 'php': 'php',
'rb': 'ruby' 'rb': 'ruby'
@ -523,7 +526,7 @@ public class Example {
<input <input
ref={fileInputRef} ref={fileInputRef}
type="file" type="file"
accept=".js,.jsx,.ts,.tsx,.py,.java,.go,.rs,.cpp,.c,.cs,.php,.rb" accept=".js,.jsx,.ts,.tsx,.py,.java,.go,.rs,.cpp,.c,.cc,.h,.hh,.cs,.php,.rb"
onChange={handleFileUpload} onChange={handleFileUpload}
className="hidden" className="hidden"
/> />

View File

@ -91,6 +91,9 @@ export function getLanguageFromExtension(extension: string): string {
'rs': 'rust', 'rs': 'rust',
'cpp': 'cpp', 'cpp': 'cpp',
'c': 'cpp', 'c': 'cpp',
'cc': 'cpp',
'h': 'cpp',
'hh': 'cpp',
'cs': 'csharp', 'cs': 'csharp',
'php': 'php', 'php': 'php',
'rb': 'ruby', 'rb': 'ruby',