Skip to content

Commit

Permalink
fix postgres-connection-string formatting (#515)
Browse files Browse the repository at this point in the history
  • Loading branch information
dferber90 authored Dec 7, 2023
1 parent 653e30b commit 41abc1c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/postgres/src/postgres-connection-string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ export function isLocalhostConnectionString(connectionString: string): boolean {
try {
// This seems silly, but we can use all of the hard work put into URL parsing
// if we just convert `postgresql://` to `https://` and then parse it as a URL.
const withHttpsProtocol = connectionString.replace(/^postgresql:\/\//, 'https://');
const withHttpsProtocol = connectionString.replace(
/^postgresql:\/\//,
'https://',
);
return new URL(withHttpsProtocol).hostname === 'localhost';
} catch (err) {
if (err instanceof TypeError) {
Expand Down

1 comment on commit 41abc1c

@vercel
Copy link

@vercel vercel bot commented on 41abc1c Dec 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.