mirror of
https://github.com/yusufipk/RepoHub.git
synced 2026-09-11 18:46:07 +00:00
fix: correct SQL parameter index and improve API URL handling
- Fixed SQL UPDATE query parameter mismatch ($4 → $3) in Homebrew package fetcher - Enhanced API_BASE_URL configuration to handle empty strings and trailing slashes, defaulting to '/api' for relative paths
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import { Platform, Package, FilterOptions } from '@/types'
|
||||
|
||||
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:3002/api'
|
||||
const API_BASE_URL = (process.env.NEXT_PUBLIC_API_URL && process.env.NEXT_PUBLIC_API_URL.trim() !== '')
|
||||
? process.env.NEXT_PUBLIC_API_URL.replace(/\/$/, '')
|
||||
: '/api'
|
||||
|
||||
class ApiClient {
|
||||
private async request<T>(endpoint: string, options: RequestInit = {}): Promise<T> {
|
||||
|
||||
@@ -153,7 +153,7 @@ export class HomebrewPackageFetcher {
|
||||
await query(
|
||||
`UPDATE packages
|
||||
SET version = $1, description = $2, updated_at = NOW()
|
||||
WHERE id = $4`,
|
||||
WHERE id = $3`,
|
||||
[pkg.version, pkg.description, existingResult.rows[0].id]
|
||||
)
|
||||
updated++
|
||||
|
||||
Reference in New Issue
Block a user