fix: resolve Supabase storage pdf URLs on client and server
Some checks failed
Staging Build / build (push) Has been cancelled
Some checks failed
Staging Build / build (push) Has been cancelled
This commit is contained in:
@@ -40,6 +40,22 @@ export function resolveSupabaseUrl(url: string | undefined): string | undefined
|
||||
}
|
||||
return resolved;
|
||||
}
|
||||
} else {
|
||||
// Server-Side fallback to localhost:8000 (for local development)
|
||||
try {
|
||||
const parsed = new URL(url);
|
||||
if (parsed.hostname === 'supabase-kong' || parsed.hostname === 'kong') {
|
||||
parsed.hostname = 'localhost';
|
||||
parsed.port = '8000';
|
||||
return parsed.toString().replace(/\/$/, '');
|
||||
}
|
||||
} catch {
|
||||
return url
|
||||
.replace('//supabase-kong:8000', '//localhost:8000')
|
||||
.replace('//kong:8000', '//localhost:8000')
|
||||
.replace('//supabase-kong', '//localhost:8000')
|
||||
.replace('//kong', '//localhost:8000');
|
||||
}
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user