k1LoW / tbls

tbls is a CI-Friendly tool for document a database, written in Go.
MIT License
3.37k stars 165 forks source link

Error parse DSN in postgres if the password has '#' character #429

Open vivacarvajalito opened 1 year ago

vivacarvajalito commented 1 year ago

What happened

If the password contains the character '#', the parse don't work

What you expected to happened

Connect to database

What stack trace or error message from tbls did you see?

parse "pg://postgres:passw": invalid port ":passw" after host

github.com/k1LoW/tbls/datasource.Analyze
    /Users/runner/work/tbls/tbls/datasource/datasource.go:57

Anything else we need to know?

Environment

# DSN (Database Source Name) to connect database
dsn: pg://postgres:passw#rd@localhost:5432/test_db
k1LoW commented 1 year ago

# is the syntax for YAML comments and is not a valid URL.

You might want to surround the DSN with a single quart and urlencode.

dsn: 'pg://postgres:passw%23rd@localhost:5432/test_db'