Skip to content

Commit

Permalink
[fix] Urlencode when passing filenames to sqlite3 (launchbadge#2655)
Browse files Browse the repository at this point in the history
  • Loading branch information
uttarayan21 authored Oct 17, 2023
1 parent b16fbeb commit b85b723
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions sqlx-sqlite/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ tracing = { version = "0.1.37", features = ["log"] }

serde = { version = "1.0.145", features = ["derive"], optional = true }
regex = { version = "1.5.5", optional = true }
urlencoding = "2.1.3"

[dependencies.libsqlite3-sys]
version = "0.26.0"
Expand Down
6 changes: 5 additions & 1 deletion sqlx-sqlite/src/connection/establish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ impl EstablishParams {
}

if !query_params.is_empty() {
filename = format!("file:{}?{}", filename, query_params.join("&"));
filename = format!(
"file:{}?{}",
urlencoding::encode(&filename),
query_params.join("&")
);
flags |= libsqlite3_sys::SQLITE_OPEN_URI;
}

Expand Down

0 comments on commit b85b723

Please sign in to comment.