Skip to content

Commit

Permalink
fix uri parse when hashbang in path
Browse files Browse the repository at this point in the history
  • Loading branch information
zebox committed Apr 30, 2021
1 parent 0cfab75 commit d853203
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions dsn.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,17 @@ func parseDSN(dsns string) (*firebirdDsn, error) {

dsn := newFirebirdDsn()

hasbang := strings.Contains(dsns, "#.")

if !strings.HasPrefix(dsns, "firebird://") {
dsns = "firebird://" + dsns
}

u, err := url.Parse(dsns)
if err != nil {
return nil, err
}

if u.User == nil {
return nil, ErrDsnUserUnknown
}
Expand All @@ -63,6 +67,9 @@ func parseDSN(dsns string) (*firebirdDsn, error) {
if !strings.ContainsRune(dsn.addr, ':') {
dsn.addr += ":3050"
}
if hasbang {
u.Path = u.Path + "#.FDB"
}
dsn.dbName = u.Path
if !strings.ContainsRune(dsn.dbName[1:], '/') {
dsn.dbName = dsn.dbName[1:]
Expand Down

0 comments on commit d853203

Please sign in to comment.