Skip to content

Commit c6400ed

Browse files
fix(web): Image proxy header fix (#703)
1 parent c040411 commit c6400ed

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Fixed
11+
- Fixed repository images not loading when anonymous access is disabled. [#703](https://github.com/sourcebot-dev/sourcebot/pull/703)
12+
1013
### Changed
1114
- Enable browser assisted autofill for username and password.[#696](https://github.com/sourcebot-dev/sourcebot/pull/696)
1215

packages/web/src/app/[domain]/repos/components/reposTable.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ export const getColumns = (context: ColumnsContext): ColumnDef<Repo>[] => [
110110
const repo = row.original;
111111
const codeHostIcon = getCodeHostIcon(repo.codeHostType);
112112
const repoImageSrc = repo.imageUrl ? getRepoImageSrc(repo.imageUrl, repo.id) : undefined;
113+
// Internal API routes require authentication headers (cookies/API keys) to be passed through.
114+
// Next.js Image Optimization doesn't forward these headers, so we use unoptimized=true
115+
// to bypass the optimization and make direct requests that include auth headers.
116+
const isInternalApiImage = repoImageSrc?.startsWith('/api/');
113117

114118
return (
115119
<div className="flex flex-row gap-2 items-center">
@@ -121,6 +125,7 @@ export const getColumns = (context: ColumnsContext): ColumnDef<Repo>[] => [
121125
width={32}
122126
height={32}
123127
className="object-cover"
128+
unoptimized={isInternalApiImage}
124129
/>
125130
) : <Image
126131
src={codeHostIcon.src}

packages/web/src/app/[domain]/repos/page.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ interface ReposPageProps {
2222
export default async function ReposPage(props: ReposPageProps) {
2323
const params = await props.searchParams;
2424

25-
console.log('asdf:');
26-
console.log(z.coerce.number().int().safeParse(params.page).error);
27-
2825
// Parse pagination parameters with defaults
2926
const page = numberSchema.safeParse(params.page).data ?? 1;
3027
const pageSize = numberSchema.safeParse(params.pageSize).data ?? 5;

0 commit comments

Comments
 (0)