Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function parseGitUrl(url, closeFastGithub) {
const args = GitUrlParse(url);
const { ref, filepath, resource, full_name: fullName } = args;
const fastGithub = await getFastGithub();
// 如果是 github 并且 autoFastGithub =true 使用
// 因为自动转化只支持 github 也可以需要关掉
const repo =
resource === 'github.com' && !closeFastGithub
? args.toString().replace(`${resource}`, fastGithub)
: args.toString();
return {
repo: urlAddGit(repo),
branch: ref || 'master',
path: `/${filepath}`,
id: `${resource}/${fullName}`, // 唯一标识一个 git 仓库
};
}