fix(mysql): percent-decode database name (#3612)

Duplicates the fix to Postgres in #3593 to the MySQL driver.

The SQLite driver already does this: e3ef8baf23/sqlx-sqlite/src/options/parse.rs (L29-L32)
This commit is contained in:
Austin Bonander 2024-11-27 14:45:46 -08:00 committed by GitHub
parent 94607b5a10
commit 35f3ec1944
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -38,7 +38,11 @@ impl MySqlConnectOptions {
let path = url.path().trim_start_matches('/');
if !path.is_empty() {
options = options.database(path);
options = options.database(
&percent_decode_str(path)
.decode_utf8()
.map_err(Error::config)?,
);
}
for (key, value) in url.query_pairs().into_iter() {