mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2025-05-02 05:10:23 +03:00
Encode connection URL to database
- If you have a database password that contains characters like `#` or `*`, sqlx will error about a InvalidPort, this is due to not encoding the url. [See issue on sqlx](https://github.com/launchbadge/sqlx/issues/1624). - Removed useless statements.
This commit is contained in:
parent
97abca2520
commit
021f2fe5b4
4 changed files with 10 additions and 10 deletions
db/db-sqlx-postgres/src
|
@ -68,14 +68,13 @@ impl Connect for ConnectionOptions {
|
|||
async fn connect(self) -> DBResult<Self::Pool> {
|
||||
let pool = match self {
|
||||
Self::Fresh(fresh) => {
|
||||
let mut connect_options =
|
||||
sqlx::postgres::PgConnectOptions::from_str(&fresh.url).unwrap();
|
||||
let mut connect_options = sqlx::postgres::PgConnectOptions::from_str(
|
||||
&urlencoding::encode(&fresh.url),
|
||||
)
|
||||
.unwrap();
|
||||
if fresh.disable_logging {
|
||||
connect_options.disable_statement_logging();
|
||||
}
|
||||
sqlx::postgres::PgConnectOptions::from_str(&fresh.url)
|
||||
.unwrap()
|
||||
.disable_statement_logging();
|
||||
fresh
|
||||
.pool_options
|
||||
.connect_with(connect_options)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue