Escape postgres password, GH-96

This commit is contained in:
Dan Sosedoff 2015-08-15 21:11:09 -05:00
parent c02d15ec34
commit 3170fb22cb
3 changed files with 5 additions and 4 deletions

View File

@ -3,6 +3,7 @@ package connection
import ( import (
"errors" "errors"
"fmt" "fmt"
neturl "net/url"
"os" "os"
"os/user" "os/user"
"strings" "strings"
@ -83,7 +84,7 @@ func BuildString(opts command.Options) (string, error) {
} }
if opts.Pass != "" { if opts.Pass != "" {
url += fmt.Sprintf(":%s", opts.Pass) url += fmt.Sprintf(":%s", neturl.QueryEscape(opts.Pass))
} }
url += fmt.Sprintf("@%s:%d", opts.Host, opts.Port) url += fmt.Sprintf("@%s:%d", opts.Host, opts.Port)

File diff suppressed because one or more lines are too long

View File

@ -452,7 +452,7 @@ function getConnectionString() {
var host = $("#pg_host").val(); var host = $("#pg_host").val();
var port = $("#pg_port").val(); var port = $("#pg_port").val();
var user = $("#pg_user").val(); var user = $("#pg_user").val();
var pass = $("#pg_password").val(); var pass = encodeURIComponent($("#pg_password").val());
var db = $("#pg_db").val(); var db = $("#pg_db").val();
if (port.length == 0) { if (port.length == 0) {