mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-12 20:35:24 +00:00
fix(gitlab): Properly handle auth for Gitlab project avatars (#345)
This commit is contained in:
parent
1ea377e7d6
commit
e423b56f42
2 changed files with 5 additions and 3 deletions
|
|
@ -121,7 +121,10 @@ export const compileGitlabConfig = async (
|
|||
const isFork = project.forked_from_project !== undefined;
|
||||
const repoDisplayName = project.path_with_namespace;
|
||||
const repoName = path.join(repoNameRoot, repoDisplayName);
|
||||
|
||||
// project.avatar_url is not directly accessible with tokens; use the avatar API endpoint if available
|
||||
const avatarUrl = project.avatar_url
|
||||
? new URL(`/api/v4/projects/${project.id}/avatar`, hostUrl).toString()
|
||||
: null;
|
||||
logger.debug(`Found gitlab repo ${repoDisplayName} with webUrl: ${projectUrl}`);
|
||||
|
||||
const record: RepoData = {
|
||||
|
|
@ -132,7 +135,7 @@ export const compileGitlabConfig = async (
|
|||
webUrl: projectUrl,
|
||||
name: repoName,
|
||||
displayName: repoDisplayName,
|
||||
imageUrl: project.avatar_url,
|
||||
imageUrl: avatarUrl,
|
||||
isFork: isFork,
|
||||
isArchived: !!project.archived,
|
||||
org: {
|
||||
|
|
|
|||
|
|
@ -419,7 +419,6 @@ export const getRepoImageSrc = (imageUrl: string | undefined, repoId: number, do
|
|||
// List of known public instances that don't require authentication
|
||||
const publicHostnames = [
|
||||
'github.com',
|
||||
'gitlab.com',
|
||||
'avatars.githubusercontent.com',
|
||||
'gitea.com',
|
||||
'bitbucket.org',
|
||||
|
|
|
|||
Loading…
Reference in a new issue