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 };
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格式
];
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";
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"
// 注意:已移除 .md因为文档文件会导致LLM返回非JSON格式
];
@ -99,6 +99,9 @@ function getLanguageFromPath(path: string): string {
'rs': 'rust',
'cpp': 'cpp',
'c': 'cpp',
'cc': 'cpp',
'h': 'cpp',
'hh': 'cpp',
'cs': 'csharp',
'php': 'php',
'rb': 'ruby',

View File

@ -226,6 +226,9 @@ public class Example {
'rs': 'rust',
'cpp': 'cpp',
'c': 'cpp',
'cc': 'cpp',
'h': 'cpp',
'hh': 'cpp',
'cs': 'csharp',
'php': 'php',
'rb': 'ruby'
@ -523,7 +526,7 @@ public class Example {
<input
ref={fileInputRef}
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}
className="hidden"
/>

View File

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