Skip to content

Commit 768aa72

Browse files
committed
add trimming of config
1 parent 44afb9c commit 768aa72

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/webviews/webview-side/integrations/BigQueryForm.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,21 @@ export const BigQueryForm: React.FC<IBigQueryFormProps> = ({ integrationId, exis
5757
const handleSubmit = (e: React.FormEvent) => {
5858
e.preventDefault();
5959

60+
const trimmedCredentials = credentials.trim();
61+
6062
// Validate credentials before submitting
61-
if (!validateCredentials(credentials)) {
63+
if (!validateCredentials(trimmedCredentials)) {
6264
return;
6365
}
6466

6567
const unnamedIntegration = format('Unnamed BigQuery Integration ({0})', integrationId);
6668

6769
const config: BigQueryIntegrationConfig = {
6870
id: integrationId,
69-
name: name || unnamedIntegration,
71+
name: (name || unnamedIntegration).trim(),
7072
type: 'bigquery',
71-
projectId,
72-
credentials
73+
projectId: projectId.trim(),
74+
credentials: trimmedCredentials
7375
};
7476

7577
onSave(config);

src/webviews/webview-side/integrations/PostgresForm.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ export const PostgresForm: React.FC<IPostgresFormProps> = ({ integrationId, exis
4646

4747
const config: PostgresIntegrationConfig = {
4848
id: integrationId,
49-
name: name || unnamedIntegration,
49+
name: (name || unnamedIntegration).trim(),
5050
type: 'postgres',
5151
host,
5252
port: parseInt(port, 10),
53-
database,
54-
username,
55-
password,
53+
database: database.trim(),
54+
username: username.trim(),
55+
password: password.trim(),
5656
ssl
5757
};
5858

0 commit comments

Comments
 (0)