File tree 2 files changed +3
-1
lines changed
packages/pg-connection-string
2 files changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,8 @@ function parse(str) {
49
49
if ( ! config . host ) {
50
50
// Only set the host if there is no equivalent query param.
51
51
config . host = decodeURIComponent ( hostname )
52
- } else if ( hostname ) {
52
+ } else if ( hostname && / ^ % 2 f / i. test ( hostname ) ) {
53
+ // Only prepend the hostname to the pathname if it is not a URL encoded Unix socket host.
53
54
result . pathname = hostname + result . pathname
54
55
}
55
56
Original file line number Diff line number Diff line change @@ -149,6 +149,7 @@ describe('parse', function () {
149
149
150
150
it ( 'configuration parameter host overrides url host' , function ( ) {
151
151
var subject = parse ( 'pg://user:pass@localhost/dbname?host=/unix/socket' )
152
+ subject . database . should . equal ( 'dbname' )
152
153
subject . host . should . equal ( '/unix/socket' )
153
154
} )
154
155
You can’t perform that action at this time.
0 commit comments