mirror of
https://github.com/brianc/node-postgres.git
synced 2025-12-08 20:16:25 +00:00
Use regex instead of startsWith which is unsupported in node 0.10
This commit is contained in:
parent
b309db074f
commit
7ec9b70180
2
index.js
2
index.js
@ -42,7 +42,7 @@ function parse(str) {
|
||||
|
||||
// If the host is missing it might be a URL-encoded path to a socket.
|
||||
var pathname = result.pathname;
|
||||
if (!config.host && pathname && pathname.toLowerCase().startsWith('%2f')) {
|
||||
if (!config.host && pathname && /^%2f/i.test(pathname)) {
|
||||
var pathnameSplit = pathname.split('/');
|
||||
config.host = decodeURIComponent(pathnameSplit[0]);
|
||||
pathname = pathnameSplit.splice(1).join('/');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user