Skip to content

Commit

Permalink
fix(driver): decode percent encoded password for flightsql
Browse files Browse the repository at this point in the history
  • Loading branch information
everpcpc committed May 18, 2023
1 parent 7869956 commit dbc43f4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ chrono = { version = "0.4.24", default-features = false, features = ["clock"] }
clap = { version = "4.1.0", features = ["derive", "env"] }
comfy-table = "6.1.4"
csv = "1.2.1"
databend-driver = { path = "../driver", version = "0.2.23", features = ["rustls", "flight-sql"] }
databend-driver = { path = "../driver", version = "0.2.24", features = ["rustls", "flight-sql"] }
futures = { version = "0.3", default-features = false, features = ["alloc"] }
humantime-serde = "1.1.1"
indicatif = "0.17.3"
Expand Down
3 changes: 2 additions & 1 deletion driver/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "databend-driver"
version = "0.2.23"
version = "0.2.24"
edition = "2021"
license = "Apache-2.0"
description = "Databend Driver for Rust"
Expand All @@ -24,6 +24,7 @@ chrono = { version = "0.4.24", default-features = false, features = ["clock"] }
databend-client = { version = "0.1.16", path = "../core" }
dyn-clone = "1.0.11"
http = "0.2.9"
percent-encoding = "2.2.0"
serde = { version = "1.0.160", default-features = false, features = ["derive"] }
serde_json = { version = "1.0.96", default-features = false, features = ["std"] }
tokio = { version = "1.27.0", features = ["macros"] }
Expand Down
5 changes: 4 additions & 1 deletion driver/src/flight_sql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use arrow_flight::utils::flight_data_to_arrow_batch;
use arrow_flight::{sql::client::FlightSqlServiceClient, FlightData};
use arrow_schema::SchemaRef as ArrowSchemaRef;
use async_trait::async_trait;
use percent_encoding::percent_decode_str;
use tokio::sync::Mutex;
use tokio_stream::{Stream, StreamExt};
use tonic::transport::{Channel, ClientTlsConfig, Endpoint};
Expand Down Expand Up @@ -247,7 +248,9 @@ impl Args {
None => format!("{}://{}:{}", scheme, host, port),
};
args.user = u.username().to_string();
args.password = u.password().unwrap_or_default().to_string();
args.password = percent_decode_str(u.password().unwrap_or_default())
.decode_utf8_lossy()
.to_string();
Ok(args)
}
}
Expand Down

0 comments on commit dbc43f4

Please sign in to comment.