0
0

修改了拉取文件的保存名字的形式,现在/改成-显示,可用中文

This commit is contained in:
xubing
2025-12-04 10:54:02 +08:00
parent 7688c54d4a
commit fdc68144b5
5 changed files with 18 additions and 8 deletions

View File

@@ -242,10 +242,15 @@ class GitService {
*/
static generateModuleFolderName(url, branch) {
const repoName = url.split('/').pop()?.replace('.git', '') || 'unknown-repo';
const branchSafeName = branch.replace(/[^a-zA-Z0-9-_]/g, '-');
let folderName = branch.trim();
folderName = folderName.replace(/^\/+/, "").replace(/\/+$/, ""); // 去掉两端 "/"
folderName = folderName.replace(/\//g, "-"); // "/" 转为 "-"
folderName = folderName.replace(/[<>:"\\|?*\r\n\t]/g, "-"); // 替换 Windows 不允许的字符
if (!folderName)
folderName = "default"; // 空的 fallback
return {
displayName: repoName,
folderName: branchSafeName
folderName
};
}
/**

File diff suppressed because one or more lines are too long