Skip to content

Commit 35f3ec1

Browse files
authored
fix(mysql): percent-decode database name (#3612)
Duplicates the fix to Postgres in #3593 to the MySQL driver. The SQLite driver already does this: https://github.com/launchbadge/sqlx/blob/e3ef8baf23bc0266959282814c014e482418eef2/sqlx-sqlite/src/options/parse.rs#L29-L32
1 parent 94607b5 commit 35f3ec1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sqlx-mysql/src/options/parse.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ impl MySqlConnectOptions {
3838

3939
let path = url.path().trim_start_matches('/');
4040
if !path.is_empty() {
41-
options = options.database(path);
41+
options = options.database(
42+
&percent_decode_str(path)
43+
.decode_utf8()
44+
.map_err(Error::config)?,
45+
);
4246
}
4347

4448
for (key, value) in url.query_pairs().into_iter() {

0 commit comments

Comments
 (0)