mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-19 00:02:03 +00:00
encode special characters in postgres url
This commit is contained in:
Generated
+1
@@ -7399,6 +7399,7 @@ dependencies = [
|
||||
"tokio",
|
||||
"tokio-postgres",
|
||||
"tracing",
|
||||
"urlencoding",
|
||||
"uuid 1.4.1",
|
||||
"windmill-api-client",
|
||||
"windmill-audit",
|
||||
|
||||
@@ -162,7 +162,7 @@ pub async fn cancel_job<'c: 'async_recursion>(
|
||||
let add_job = add_completed_job_error(
|
||||
&db,
|
||||
&job_running,
|
||||
format!("canceled by {username}: (force cancel: {force_cancel}"),
|
||||
format!("canceled by {username}: (force cancel: {force_cancel})"),
|
||||
serde_json::json!({"message": format!("Job canceled: {reason} by {username}"), "name": "Canceled", "reason": reason, "canceler": username}),
|
||||
None,
|
||||
rsmq.clone(),
|
||||
|
||||
@@ -69,6 +69,7 @@ rust_decimal.workspace = true
|
||||
jsonwebtoken = { workspace = true, optional = true }
|
||||
sha2 = { workspace = true, optional = true }
|
||||
pem = { workspace = true, optional = true }
|
||||
urlencoding.workspace = true
|
||||
|
||||
[build-dependencies]
|
||||
deno_fetch.workspace = true
|
||||
|
||||
@@ -19,6 +19,7 @@ use windmill_parser_sql::parse_pgsql_sig;
|
||||
|
||||
use crate::common::transform_json_value;
|
||||
use crate::{AuthedClient, JobCompleted};
|
||||
use urlencoding::encode;
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct PgDatabase {
|
||||
@@ -49,13 +50,14 @@ pub async fn do_postgresql(
|
||||
let sslmode = database.sslmode.unwrap_or("prefer".to_string());
|
||||
let database = format!(
|
||||
"postgres://{user}:{password}@{host}:{port}/{dbname}?sslmode={sslmode}",
|
||||
user = database.user.unwrap_or("postgres".to_string()),
|
||||
password = database.password.unwrap_or("".to_string()),
|
||||
host = database.host,
|
||||
user = encode(&database.user.unwrap_or("postgres".to_string())),
|
||||
password = encode(&database.password.unwrap_or("".to_string())),
|
||||
host = encode(&database.host),
|
||||
port = database.port.unwrap_or(5432),
|
||||
dbname = database.dbname,
|
||||
sslmode = sslmode
|
||||
);
|
||||
tracing::error!("database: {}", database);
|
||||
let (client, handle) = if sslmode == "require" {
|
||||
let (client, connection) = tokio_postgres::connect(
|
||||
&database,
|
||||
|
||||
Reference in New Issue
Block a user