Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/utils/api-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ export class APIClient {
orgSlug: string | null,
uuid: string,
): Promise<PatchResponse | null> {
// Public proxy uses simpler URL structure (no org slug needed)
// Public proxy uses /patch/* prefix for patch endpoints
const path = this.usePublicProxy
? `/view/${uuid}`
? `/patch/view/${uuid}`
: `/v0/orgs/${orgSlug}/patches/view/${uuid}`
return this.get(path)
}
Expand All @@ -168,9 +168,9 @@ export class APIClient {
orgSlug: string | null,
cveId: string,
): Promise<SearchResponse> {
// Public proxy uses simpler URL structure (no org slug needed)
// Public proxy uses /patch/* prefix for patch endpoints
const path = this.usePublicProxy
? `/by-cve/${encodeURIComponent(cveId)}`
? `/patch/by-cve/${encodeURIComponent(cveId)}`
: `/v0/orgs/${orgSlug}/patches/by-cve/${encodeURIComponent(cveId)}`
const result = await this.get<SearchResponse>(path)
return result ?? { patches: [], canAccessPaidPatches: false }
Expand All @@ -184,9 +184,9 @@ export class APIClient {
orgSlug: string | null,
ghsaId: string,
): Promise<SearchResponse> {
// Public proxy uses simpler URL structure (no org slug needed)
// Public proxy uses /patch/* prefix for patch endpoints
const path = this.usePublicProxy
? `/by-ghsa/${encodeURIComponent(ghsaId)}`
? `/patch/by-ghsa/${encodeURIComponent(ghsaId)}`
: `/v0/orgs/${orgSlug}/patches/by-ghsa/${encodeURIComponent(ghsaId)}`
const result = await this.get<SearchResponse>(path)
return result ?? { patches: [], canAccessPaidPatches: false }
Expand All @@ -206,9 +206,9 @@ export class APIClient {
orgSlug: string | null,
purl: string,
): Promise<SearchResponse> {
// Public proxy uses simpler URL structure (no org slug needed)
// Public proxy uses /patch/* prefix for patch endpoints
const path = this.usePublicProxy
? `/by-package/${encodeURIComponent(purl)}`
? `/patch/by-package/${encodeURIComponent(purl)}`
: `/v0/orgs/${orgSlug}/patches/by-package/${encodeURIComponent(purl)}`
const result = await this.get<SearchResponse>(path)
return result ?? { patches: [], canAccessPaidPatches: false }
Expand Down