mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-12 04:15:30 +00:00
remove unneeded PAT embed check
This commit is contained in:
parent
2b46e8a9d6
commit
c40576d0a5
2 changed files with 0 additions and 14 deletions
|
|
@ -1,7 +1,6 @@
|
||||||
import { CheckRepoActions, GitConfigScope, simpleGit, SimpleGitProgressEvent } from 'simple-git';
|
import { CheckRepoActions, GitConfigScope, simpleGit, SimpleGitProgressEvent } from 'simple-git';
|
||||||
import { mkdir } from 'node:fs/promises';
|
import { mkdir } from 'node:fs/promises';
|
||||||
import { env } from './env.js';
|
import { env } from './env.js';
|
||||||
import { doesHaveEmbeddedToken } from './utils.js';
|
|
||||||
|
|
||||||
type onProgressFn = (event: SimpleGitProgressEvent) => void;
|
type onProgressFn = (event: SimpleGitProgressEvent) => void;
|
||||||
|
|
||||||
|
|
@ -28,10 +27,6 @@ export const cloneRepository = async (
|
||||||
})
|
})
|
||||||
|
|
||||||
if (authHeader) {
|
if (authHeader) {
|
||||||
if (doesHaveEmbeddedToken(cloneUrl)) {
|
|
||||||
throw new Error("Cannot use auth header when clone URL has embedded token");
|
|
||||||
}
|
|
||||||
|
|
||||||
await git.clone(
|
await git.clone(
|
||||||
cloneUrl,
|
cloneUrl,
|
||||||
path,
|
path,
|
||||||
|
|
@ -87,10 +82,6 @@ export const fetchRepository = async (
|
||||||
})
|
})
|
||||||
|
|
||||||
if (authHeader) {
|
if (authHeader) {
|
||||||
if (doesHaveEmbeddedToken(cloneUrl)) {
|
|
||||||
throw new Error("Cannot use auth header when clone URL has embedded token");
|
|
||||||
}
|
|
||||||
|
|
||||||
await git.addConfig("http.extraHeader", authHeader);
|
await git.addConfig("http.extraHeader", authHeader);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -241,8 +241,3 @@ const createGitCloneUrlWithToken = (cloneUrl: string, credentials: { username?:
|
||||||
}
|
}
|
||||||
return url.toString();
|
return url.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
export const doesHaveEmbeddedToken = (cloneUrl: string) => {
|
|
||||||
const url = new URL(cloneUrl);
|
|
||||||
return url.username || url.password;
|
|
||||||
}
|
|
||||||
Loading…
Reference in a new issue