mirror of
https://github.com/sosedoff/pgweb.git
synced 2024-12-15 03:36:33 +03:00
Verify that database name is specified when opening the connection
This commit is contained in:
parent
8ea8960696
commit
108754a8c3
@ -119,6 +119,11 @@ func NewFromUrl(url string, sshInfo *shared.SSHInfo) (*Client, error) {
|
||||
fmt.Println("Creating a new client for:", url)
|
||||
}
|
||||
|
||||
uri, err := neturl.Parse(url)
|
||||
if err == nil && uri.Path == "" {
|
||||
return nil, fmt.Errorf("Database name is not provided")
|
||||
}
|
||||
|
||||
db, err := sqlx.Open("postgres", url)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Loading…
Reference in New Issue
Block a user